From e064d3798848c89c641a11114ccc5856eecca5aa Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 24 Jun 2020 02:14:51 +1000 Subject: [PATCH] mainwindow: check for connected items before saving Fixes segfault when saving an empty project/a project with no sequence open. --- app/window/mainwindow/mainwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/window/mainwindow/mainwindow.cpp b/app/window/mainwindow/mainwindow.cpp index 38f364cb2..1c5f2b111 100644 --- a/app/window/mainwindow/mainwindow.cpp +++ b/app/window/mainwindow/mainwindow.cpp @@ -129,11 +129,15 @@ MainWindowLayoutInfo MainWindow::SaveLayout() const MainWindowLayoutInfo info; foreach (ProjectPanel* panel, folder_panels_) { - info.add_folder(static_cast(panel->get_root_index().internalPointer())); + if (panel->project()) { + info.add_folder(static_cast(panel->get_root_index().internalPointer())); + } } foreach (TimelinePanel* panel, timeline_panels_) { - info.add_sequence(static_cast(panel->GetConnectedViewer()->parent())); + if (panel->GetConnectedViewer()) { + info.add_sequence(static_cast(panel->GetConnectedViewer()->parent())); + } } info.set_state(saveState());