diff --git a/common/include/Dict.hpp b/common/include/Dict.hpp index fb005e7fae652778a711e349308df8dd5fd8b094..5d9f6545239eebba04b3929e0acd59524de95a68 100644 --- a/common/include/Dict.hpp +++ b/common/include/Dict.hpp @@ -30,10 +30,10 @@ class Dict private : void readFromFile(const char * filename); + void insert(const std::string & element); public : - void insert(const std::string & element); int getIndexOrInsert(const std::string & element); void setState(State state); State getState() const; diff --git a/common/src/Dict.cpp b/common/src/Dict.cpp index c451ecd15160d1358e43f6a1b23dbd9de3e0b31f..d96d954a8c89e415711791302630e95c81ca9c49 100644 --- a/common/src/Dict.cpp +++ b/common/src/Dict.cpp @@ -63,6 +63,9 @@ void Dict::insert(const std::string & element) int Dict::getIndexOrInsert(const std::string & element) { + if (element.empty()) + return getIndexOrInsert(nullValueStr); + const auto & found = elementsToIndexes.find(element); if (found == elementsToIndexes.end())