diff --git a/editor/SphinxEditorWidget.cpp b/editor/SphinxEditorWidget.cpp index 984c099..1805d64 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); }