From 59360761813470e4aa939e960023664ac452aa7f Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Mon, 14 Aug 2023 23:54:47 +0200 Subject: [PATCH] Fix crash when calling dialog-show with bogus names (#12873). --- src/frontends/qt/GuiView.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index 764921c460..ddf7e8df85 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -5310,14 +5310,17 @@ Dialog * GuiView::findOrBuild(string const & name, bool hide_it) return dialog; dialog = build(name); - d.dialogs_[name].reset(dialog); - // Force a uniform style for group boxes - // On Mac non-flat works better, on Linux flat is standard - flatGroupBoxes(dialog->asQWidget(), guiApp->platformName() != "cocoa"); - if (lyxrc.allow_geometry_session) - dialog->restoreSession(); - if (hide_it) - dialog->hideView(); + if (dialog) { + + d.dialogs_[name].reset(dialog); + // Force a uniform style for group boxes + // On Mac non-flat works better, on Linux flat is standard + flatGroupBoxes(dialog->asQWidget(), guiApp->platformName() != "cocoa"); + if (lyxrc.allow_geometry_session) + dialog->restoreSession(); + if (hide_it) + dialog->hideView(); + } return dialog; } -- 2.39.5