Skip to content

Commit

Permalink
PreferenceManager: don't crash on empty preferences file
Browse files Browse the repository at this point in the history
  • Loading branch information
azonenberg committed Nov 7, 2023
1 parent a9117dc commit 07c127d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ngscopeclient/PreferenceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ void PreferenceManager::LoadPreferences()
try
{
LogTrace("Loading preferences from %s\n", m_filePath.c_str());
auto doc = YAML::LoadAllFromFile(m_filePath)[0];
this->m_treeRoot.FromYAML(doc);
auto docs = YAML::LoadAllFromFile(m_filePath);
if(docs.size())
this->m_treeRoot.FromYAML(docs[0]);
}
catch(const exception& ex)
{
Expand Down

0 comments on commit 07c127d

Please sign in to comment.