Skip to content

Commit

Permalink
Fix the case, where there are no entries inside the normalization dict
Browse files Browse the repository at this point in the history
Avoid NPE, if there is not yet any user dictionary entry added.

Signed-off-by: Daniel Schnell <[email protected]>
  • Loading branch information
lumpidu committed Apr 24, 2024
1 parent 83595c9 commit 4d7db18
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ private String replaceFromNormDict(String sentence) {
// NormDictEntry Db
String normalized = sentence;
final HashMap<NormDictEntry, Pattern> entriesMap = App.getAppRepository().getCachedUserDictEntries();
if (null == entriesMap)
return normalized;

final List<NormDictEntry> entries = new ArrayList<>(entriesMap.keySet());

// sort terms according to their size descendingly to match longer strings first.
Expand Down

0 comments on commit 4d7db18

Please sign in to comment.