Skip to content

Commit

Permalink
fix: nil for the LookupWithRoot
Browse files Browse the repository at this point in the history
Signed-off-by: saltbo <[email protected]>
  • Loading branch information
saltbo committed Mar 23, 2023
1 parent e3b14bb commit da6e134
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/dict/dict.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ func (d *Dict) Lookup(ctx context.Context, name string) (*model.Vocabulary, erro

func (d *Dict) LookupWithRoot(ctx context.Context, name string) (*model.Vocabulary, error) {
_, v, err := d.Find(name)
if err != nil {
return nil, err
} else if v == nil {
return nil, fmt.Errorf("not found root for the word: %v", name)
}

return v.Vocabulary, err
}

Expand Down

0 comments on commit da6e134

Please sign in to comment.