From 21b43ada158bf64d2a593441ae07ac9dae1d4d4c Mon Sep 17 00:00:00 2001 From: Joerg Kreuzberger Date: Fri, 18 Jun 2021 11:44:47 +0200 Subject: [PATCH] [] Fix crash if no rightpane is enabled --- editor/SphinxEditorWidget.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/editor/SphinxEditorWidget.cpp b/editor/SphinxEditorWidget.cpp index 63925a0..05aa9c6 100644 --- a/editor/SphinxEditorWidget.cpp +++ b/editor/SphinxEditorWidget.cpp @@ -58,9 +58,9 @@ void EditorWidget::onCustomContextMenu(const QPoint &pos) menu.addSeparator(); if (mRightPane) { menu.addAction(mShowRightPaneAction); - } - if (!mRightPane->html().isEnabled()) { - menu.addAction(mUrlAction); + if (!mRightPane->html().isEnabled()) { + menu.addAction(mUrlAction); + } } menu.exec(this->mapToGlobal(pos)); @@ -157,8 +157,10 @@ void EditorWidget::connectActions() void EditorWidget::onUrlAction() { onShowRightPane(true); - mRightPane->setCurrentTab(RightPaneWidget::PAGE_HTML); - mRightPane->html().updateView(); + if (mRightPane) { + mRightPane->setCurrentTab(RightPaneWidget::PAGE_HTML); + mRightPane->html().updateView(); + } } void EditorWidget::onToggleRightPane() @@ -174,9 +176,8 @@ void EditorWidget::onToggleRightPane() void EditorWidget::onPreviewHtmlChanged(const QString &html) { - if (!html.isEmpty() && mRightPane->isVisible()) { + if (!html.isEmpty() && mRightPane && mRightPane->isVisible()) { onShowRightPane(true); - //mRightPane->setCurrentTab(RightPaneWidget::PAGE_PREVIEW); mRightPane->setTabEnabled(RightPaneWidget::PAGE_PREVIEW, true); mRightPane->preview().setHtml(html); }