From 2e4e18161bc2a80869fa3171c8855c3bca1393ac Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 4 Oct 2018 09:58:41 +0200 Subject: [PATCH] Debugger: Guard against some impossible situations Change-Id: Ia1fd356b4f8ef71dd3b456a3b28598ff680b9344 Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggermainwindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 7c7e632388d..c1586e6edd4 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -568,6 +568,7 @@ void Perspective::setEnabled(bool enabled) QToolButton *PerspectivePrivate::setupToolButton(QAction *action) { + QTC_ASSERT(action, return nullptr); auto toolButton = new QToolButton(m_innerToolBar); toolButton->setProperty("panelwidget", true); toolButton->setDefaultAction(action); @@ -577,16 +578,19 @@ QToolButton *PerspectivePrivate::setupToolButton(QAction *action) void Perspective::addToolBarAction(QAction *action) { + QTC_ASSERT(action, return); d->setupToolButton(action); } void Perspective::addToolBarAction(OptionalAction *action) { + QTC_ASSERT(action, return); action->m_toolButton = d->setupToolButton(action); } void Perspective::addToolBarWidget(QWidget *widget) { + QTC_ASSERT(widget, return); // QStyle::polish is called before it is added to the toolbar, explicitly make it a panel widget widget->setProperty("panelwidget", true); widget->setParent(d->m_innerToolBar); @@ -644,6 +648,7 @@ void Perspective::addWindow(QWidget *widget, bool visibleByDefault, Qt::DockWidgetArea area) { + QTC_ASSERT(widget, return); DockOperation op; op.widget = widget; if (anchorWidget)