diff options
Diffstat (limited to 'extractor/data_array.cc')
-rw-r--r-- | extractor/data_array.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/extractor/data_array.cc b/extractor/data_array.cc index 1097caf3..cd430c69 100644 --- a/extractor/data_array.cc +++ b/extractor/data_array.cc @@ -147,7 +147,8 @@ bool DataArray::HasWord(const string& word) const { } int DataArray::GetWordId(const string& word) const { - return word2id.find(word)->second; + auto result = word2id.find(word); + return result == word2id.end() ? -1 : result->second; } string DataArray::GetWord(int word_id) const { |