Coverity correctly spotted that the existing code creates a temporary
map and returns a value from it. It is not possible to make the map
const& directly because operator[] may change the map.
Therefore, we use map::find instead.
string const & BufferParams::defaultBiblioStyle() const
{
- map<string, string> bs = documentClass().defaultBiblioStyle();
- return bs[theCiteEnginesList.getTypeAsString(citeEngineType())];
+ map<string, string> const & bs = documentClass().defaultBiblioStyle();
+ auto cit = bs.find(theCiteEnginesList.getTypeAsString(citeEngineType()));
+ if (cit != bs.end())
+ return cit->second;
+ else
+ return empty_string();
}