Skip to content
Snippets Groups Projects
Commit 1da32f54 authored by Franck Dary's avatar Franck Dary
Browse files

Fixed Dict (cannot have empty elements)

parent 79392732
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment