Skip to content

Commit 1c5e3bc

Browse files
authored
try fix welcome scene widget (#2670)
1 parent 479f8f8 commit 1c5e3bc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/widgets/viewarea.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ ViewSplit *ViewArea::createViewSplit(QWidget *p_parent, ID p_viewSplitId) {
302302
void ViewArea::showSceneWidget() {
303303
Q_ASSERT(!m_sceneWidget);
304304
Q_ASSERT(m_splits.isEmpty());
305+
if (m_sceneWidget || !m_splits.isEmpty()) {
306+
// Double check.
307+
return;
308+
}
305309
auto text = DocsUtils::getDocText(QStringLiteral("get_started.txt"));
306310
// TODO: a more informative widget, such as adding workspace list and LRU files.
307311
m_sceneWidget = new QLabel(text, this);
@@ -310,6 +314,10 @@ void ViewArea::showSceneWidget() {
310314

311315
void ViewArea::hideSceneWidget() {
312316
Q_ASSERT(m_sceneWidget);
317+
if (!m_sceneWidget) {
318+
// Double check.
319+
return;
320+
}
313321
m_mainLayout->removeWidget(m_sceneWidget);
314322
delete m_sceneWidget;
315323
m_sceneWidget = nullptr;

0 commit comments

Comments
 (0)