diff --git a/app/core.cpp b/app/core.cpp index c06123206..4aa3a02de 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -358,18 +358,30 @@ void Core::DialogProjectPropertiesShow() void Core::DialogExportShow() { - TimeBasedPanel* latest_time_based = PanelManager::instance()->MostRecentlyFocused(); + // First try the most recently focused time based window + TimeBasedPanel* time_panel = PanelManager::instance()->MostRecentlyFocused(); - if (latest_time_based && latest_time_based->GetConnectedViewer()) { - if (latest_time_based->GetConnectedViewer()->GetLength() == 0) { + // If that fails try defaulting to the first timeline (i.e. if a project has just been loaded). + if (!time_panel->GetConnectedViewer()) { + // Safe to assume there will always be one timeline. + time_panel = PanelManager::instance()->GetPanelsOfType().first(); + } + + if (time_panel && time_panel->GetConnectedViewer()) { + if (time_panel->GetConnectedViewer()->GetLength() == 0) { QMessageBox::critical(main_window_, tr("Error"), tr("This Sequence is empty. There is nothing to export."), QMessageBox::Ok); } else { - ExportDialog ed(latest_time_based->GetConnectedViewer(), main_window_); + ExportDialog ed(time_panel->GetConnectedViewer(), main_window_); ed.exec(); } + } else { + QMessageBox::critical(main_window_, + tr("Error"), + tr("No valid sequence detected.\n\nMake sure a sequence is loaded and it has a connected Viewer node."), + QMessageBox::Ok); } }