From d9ddd3524535ecb5debc2157ddf02922b6bb1685 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 19 Mar 2019 18:23:24 +0100 Subject: Add runtime guard that pages are KCMs in KCMultiDialog Summary: This situation can come up if a KCMultiDialog subclass adds pages directly that aren't KCModules. BUG: 405440 Test Plan: acheronuk tested this patch on a crashing example Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D19888 --- src/kcmultidialog.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/kcmultidialog.cpp b/src/kcmultidialog.cpp index 9ddd43b..b689f27 100644 --- a/src/kcmultidialog.cpp +++ b/src/kcmultidialog.cpp @@ -99,7 +99,6 @@ void KCMultiDialogPrivate::_k_slotCurrentPageChanged(KPageWidgetItem *current, K currentModule = modules[i].kcm; } } - Q_ASSERT(currentModule); // For some reason the KCModuleQml modules handle their own margin internally // to match that we need to adjust the spacing of our page widget @@ -108,7 +107,7 @@ void KCMultiDialogPrivate::_k_slotCurrentPageChanged(KPageWidgetItem *current, K // TODO KF6 Fix this situation. - if (currentModule->realModule() && currentModule->realModule()->inherits("KCModuleQml")) { + if (currentModule && currentModule->realModule() && currentModule->realModule()->inherits("KCModuleQml")) { bool padHackLeft = false; bool padHackRight = false; if (q->pageWidget()->model()->rowCount() < 2) { -- cgit v1.1