1
0
Fork 0

fixed a NullPointerException when loading a dictionary from an update notification

This commit is contained in:
sspanak 2025-06-10 13:28:52 +03:00 committed by Dimo Karaivanov
parent 2339aec1b6
commit 78b78923cf

View file

@ -108,7 +108,7 @@ public class DictionaryLoader {
public static void load(Context context, Language language) {
self.load(context, new ArrayList<>() {{ add(language); }});
getInstance(context).load(context, new ArrayList<>() {{ add(language); }});
}
@ -125,7 +125,7 @@ public class DictionaryLoader {
DataStore.getLastLanguageUpdateTime(
(hash) -> {
self.lastAutoLoadAttemptTime.put(language.getId(), System.currentTimeMillis());
getInstance(context).lastAutoLoadAttemptTime.put(language.getId(), System.currentTimeMillis());
// no words at all, load without confirmation
if (hash.isEmpty()) {
@ -206,12 +206,12 @@ public class DictionaryLoader {
} catch (DictionaryImportAbortedException e) {
sqlite.failTransaction();
stop();
self.lastAutoLoadAttemptTime.put(language.getId(), null);
lastAutoLoadAttemptTime.put(language.getId(), null);
Logger.i(LOG_TAG, e.getMessage() + ". File '" + language.getDictionaryFile() + "' not imported.");
} catch (DictionaryImportException e) {
stop();
sqlite.failTransaction();
self.lastAutoLoadAttemptTime.put(language.getId(), null);
lastAutoLoadAttemptTime.put(language.getId(), null);
sendImportError(DictionaryImportException.class.getSimpleName(), language.getId(), e.line);
Logger.e(
@ -226,9 +226,9 @@ public class DictionaryLoader {
sendError(e.getClass().getSimpleName(), language.getId());
if (e instanceof UnknownHostException) {
self.lastAutoLoadAttemptTime.put(language.getId(), System.currentTimeMillis());
lastAutoLoadAttemptTime.put(language.getId(), System.currentTimeMillis());
} else {
self.lastAutoLoadAttemptTime.put(language.getId(), null);
lastAutoLoadAttemptTime.put(language.getId(), null);
}
Logger.e(