Skip to content

Fix generic access to empty lists

When reading json files into boost::ptree a shortcoming of ptree becomes obvious. The standard ptree, which is conceptually a

struct ptree
{
   string data;                          // data associated with the node
   list< pair<string, ptree> > children; // ordered list of named children
};

, cannot distinguish between an empty string entry key -> "" and an empty array entry key -> []. In both cases the internal data string and the children list are empty.

This was noticed and mentioned by @aporeba in MR !30690 (merged). Here I am fixing this issue by removing the exception throwing for this particular case. If getList(key) is called for key -> "", the return value will be and empty vector<TrigConf::DataStructure>

cc: @aporeba , @tamartin

Merge request reports