if snapshot is empty after creation, don't add it to the list

This commit is contained in:
Nikolaus Gullotta 2019-08-22 12:49:30 -05:00 committed by Nikolaus Gullotta
parent b14b9f352e
commit 426cbd0287
No known key found for this signature in database
GPG key ID: 565F60578092AA31

View file

@ -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);