Skip to content

Commit

Permalink
Session: don't crash on empty filters file
Browse files Browse the repository at this point in the history
  • Loading branch information
azonenberg committed Nov 7, 2023
1 parent 07c127d commit eac6836
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ngscopeclient/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit eac6836

Please sign in to comment.