From eac6836898140a3755160261a7afbc5907d4fe5d Mon Sep 17 00:00:00 2001 From: "Andrew D. Zonenberg" Date: Tue, 7 Nov 2023 00:09:06 -0800 Subject: [PATCH] Session: don't crash on empty filters file --- src/ngscopeclient/Session.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ngscopeclient/Session.cpp b/src/ngscopeclient/Session.cpp index d1390651f..46d80a63b 100644 --- a/src/ngscopeclient/Session.cpp +++ b/src/ngscopeclient/Session.cpp @@ -295,8 +295,11 @@ bool Session::LoadWaveformData(int version, const string& dataDir) fclose(fp); auto docs = YAML::LoadAllFromFile(fname); - if(!LoadWaveformDataForFilters(version, docs[0], dataDir)) - return false; + if(docs.size()) + { + if(!LoadWaveformDataForFilters(version, docs[0], dataDir)) + return false; + } } //Load data for each scope @@ -333,6 +336,8 @@ bool Session::LoadWaveformDataForFilters( const YAML::Node& node, const string& dataDir) { + if(!node) + return true; auto waveforms = node["waveforms"]; if(!waveforms) return true;