From 4d7db18a308e94d084014bccd635cd87ca82d8d5 Mon Sep 17 00:00:00 2001 From: Daniel Schnell Date: Wed, 24 Apr 2024 11:55:27 +0000 Subject: [PATCH] Fix the case, where there are no entries inside the normalization dict Avoid NPE, if there is not yet any user dictionary entry added. Signed-off-by: Daniel Schnell --- .../java/com/grammatek/simaromur/frontend/TTSNormalizer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/grammatek/simaromur/frontend/TTSNormalizer.java b/app/src/main/java/com/grammatek/simaromur/frontend/TTSNormalizer.java index 437aa8a..6ba952d 100644 --- a/app/src/main/java/com/grammatek/simaromur/frontend/TTSNormalizer.java +++ b/app/src/main/java/com/grammatek/simaromur/frontend/TTSNormalizer.java @@ -153,6 +153,9 @@ private String replaceFromNormDict(String sentence) { // NormDictEntry Db String normalized = sentence; final HashMap entriesMap = App.getAppRepository().getCachedUserDictEntries(); + if (null == entriesMap) + return normalized; + final List entries = new ArrayList<>(entriesMap.keySet()); // sort terms according to their size descendingly to match longer strings first.