From 17e6bd8587cd4651fbf018d18ef29530501bff06 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 3 Mar 2020 19:06:52 +0100 Subject: [PATCH] decorationbridge: Fix crash on plasma mobile Summary: For some reason there m_settings is null there, don't crash in this case. The code definitely contemplates the possibility since it's null by default and on some DecorationBridge::reconfigure() paths. Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: zzag, anthonyfieroni, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D27809 --- decorations/decorationbridge.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/decorations/decorationbridge.cpp b/decorations/decorationbridge.cpp index c257cf1d5e..c3b4867e8e 100644 --- a/decorations/decorationbridge.cpp +++ b/decorations/decorationbridge.cpp @@ -311,17 +311,21 @@ QString settingsProperty(const QVariant &variant) QString DecorationBridge::supportInformation() const { QString b; - b.append(QStringLiteral("Plugin: %1\n").arg(m_plugin)); - b.append(QStringLiteral("Theme: %1\n").arg(m_theme)); - b.append(QStringLiteral("Plugin recommends border size: %1\n").arg(m_recommendedBorderSize.isNull() ? "No" : m_recommendedBorderSize)); - b.append(QStringLiteral("Blur: %1\n").arg(m_blur)); - const QMetaObject *metaOptions = m_settings->metaObject(); - for (int i=0; ipropertyCount(); ++i) { - const QMetaProperty property = metaOptions->property(i); - if (QLatin1String(property.name()) == QLatin1String("objectName")) { - continue; + if (m_noPlugin) { + b.append(QStringLiteral("Decorations are disabled")); + } else { + b.append(QStringLiteral("Plugin: %1\n").arg(m_plugin)); + b.append(QStringLiteral("Theme: %1\n").arg(m_theme)); + b.append(QStringLiteral("Plugin recommends border size: %1\n").arg(m_recommendedBorderSize.isNull() ? "No" : m_recommendedBorderSize)); + b.append(QStringLiteral("Blur: %1\n").arg(m_blur)); + const QMetaObject *metaOptions = m_settings->metaObject(); + for (int i=0; ipropertyCount(); ++i) { + const QMetaProperty property = metaOptions->property(i); + if (QLatin1String(property.name()) == QLatin1String("objectName")) { + continue; + } + b.append(QStringLiteral("%1: %2\n").arg(property.name()).arg(settingsProperty(m_settings->property(property.name())))); } - b.append(QStringLiteral("%1: %2\n").arg(property.name()).arg(settingsProperty(m_settings->property(property.name())))); } return b; }