From 347a25d13d264efc71fc74059a5e4e607badf9f1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 24 Jun 2020 20:48:06 +0200 Subject: [PATCH] [libcalamaresui] Avoid nullptr deref - there's a check already there, and probably this means things are hopelessly broken anyway, but let's not crash here. --- src/libcalamaresui/ViewManager.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index e72c434f8..40e621ae8 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -128,15 +128,19 @@ ViewManager::insertViewStep( int before, ViewStep* step ) { cError() << "ViewStep" << step->moduleInstanceKey() << "has no widget."; } - - QLayout* layout = step->widget()->layout(); - if ( layout ) + else { - layout->setContentsMargins( 0, 0, 0, 0 ); + // step->adjustMargins() "some magic" + QLayout* layout = step->widget()->layout(); + if ( layout ) + { + layout->setContentsMargins( 0, 0, 0, 0 ); + } + + m_stack->insertWidget( before, step->widget() ); + m_stack->setCurrentIndex( 0 ); + step->widget()->setFocus(); } - m_stack->insertWidget( before, step->widget() ); - m_stack->setCurrentIndex( 0 ); - step->widget()->setFocus(); emit endInsertRows(); }