Skip to content
2 changes: 1 addition & 1 deletion keyvi/include/keyvi/dictionary/fsa/automata.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class Automata final {
* @return index of root state.
*/
uint64_t GetStartState() const {
return dictionary_properties_->GetNumberOfStates() != 0 ? dictionary_properties_->GetStartState() : 0;
return dictionary_properties_->GetNumberOfKeys() != 0 ? dictionary_properties_->GetStartState() : 0;
}

uint64_t GetNumberOfKeys() const { return dictionary_properties_->GetNumberOfKeys(); }
Expand Down
Binary file added rust/test_data/empty-key-dict.kv
Binary file not shown.
9 changes: 9 additions & 0 deletions rust/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ mod tests {
}
}

#[test]
fn get_all_items_empty() {
// uses dictionary created using keyvi < 0.7.2, see gh#368
let dict = dictionary::Dictionary::new("test_data/empty-key-dict.kv").unwrap();

let all_items: Vec<_> = dict.get_all_items().collect();
assert!(all_items.is_empty());
}

#[test]
fn multi_word_completions() {
let mut values = vec![
Expand Down
Loading