Skip to content

Commit

Permalink
[] Fix crash if no rightpane is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kreuzberger committed Jun 18, 2021
1 parent a46a9a1 commit 21b43ad
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions editor/SphinxEditorWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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()
Expand All @@ -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);
}
Expand Down

0 comments on commit 21b43ad

Please sign in to comment.