Skip to content

Commit 0df1a41

Browse files
Fix potential crash when restoring container state (#381)
This fixes a crash which could occur when restoring the state of a floating container to a non-floating container. This was because `ads::CDockContainerWidget::RestoreState()` will unconditionally assume this is floating if the XML has the `Floating` boolean set, and will dereference `floatingWidget()`. If this isn't floating, `floatingWidget()` will return `nullptr`, leading to a crash when it's subsequently used. Fixes #379.
1 parent 21badd5 commit 0df1a41

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/DockContainerWidget.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,10 @@ bool CDockContainerWidget::restoreState(CDockingStateReader& s, bool Testing)
16801680
if (!Testing)
16811681
{
16821682
CFloatingDockContainer* FloatingWidget = floatingWidget();
1683-
FloatingWidget->restoreGeometry(Geometry);
1683+
if (FloatingWidget)
1684+
{
1685+
FloatingWidget->restoreGeometry(Geometry);
1686+
}
16841687
}
16851688
}
16861689

0 commit comments

Comments
 (0)