From 426cbd02873a36e88bd57355a637cd1983a5170d Mon Sep 17 00:00:00 2001 From: Nikolaus Gullotta Date: Thu, 22 Aug 2019 12:49:30 -0500 Subject: [PATCH] if snapshot is empty after creation, don't add it to the list --- libs/ardour/mixer_snapshot_manager.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/ardour/mixer_snapshot_manager.cc b/libs/ardour/mixer_snapshot_manager.cc index 369a8632d2..6f173440d7 100644 --- a/libs/ardour/mixer_snapshot_manager.cc +++ b/libs/ardour/mixer_snapshot_manager.cc @@ -211,6 +211,12 @@ void MixerSnapshotManager::create_snapshot(std::string const& label, RouteList& snapshot->snap(); } + //is this even possible? either way, sanity check + if(snapshot->empty()) { + delete snapshot; + return; + } + snapshot->set_label(label); snapshot->write(path); @@ -235,6 +241,13 @@ void MixerSnapshotManager::create_snapshot(std::string const& label, std::string ensure_snapshot_dir(global); const string path = global ? _global_path : _local_path; MixerSnapshot* snapshot = new MixerSnapshot(_session, from_path); + + //clearly from_path doesn't point to a parsable state file + if(snapshot->empty()) { + delete snapshot; + return; + } + snapshot->set_label(label); snapshot->write(path);