fix npe on key completion with deleted keys

Resolves #67
This commit is contained in:
Marcel Haßlinger 2021-12-07 11:26:00 +01:00
parent 80ae80dc54
commit 6c5f06f461
2 changed files with 12 additions and 9 deletions

View File

@ -3,6 +3,10 @@
# easy-i18n Changelog
## [Unreleased]
### Fixed
- NullPointerException on key completion
## [1.6.0]
### Added
- The search function now supports full-text-search
- Automatically reload translation data on file system change

View File

@ -38,10 +38,6 @@ public class KeyCompletionProvider extends CompletionProvider<CompletionParamete
String path = result.getPrefixMatcher().getPrefix();
if(pathPrefix == null) {
pathPrefix = "";
}
if(path.startsWith(pathPrefix)) {
path = path.substring(pathPrefix.length());
@ -77,6 +73,8 @@ public class KeyCompletionProvider extends CompletionProvider<CompletionParamete
} else {
Translation translation = store.getData().getTranslation(key);
if(translation != null) {
String content = translation.get(previewLocale);
result.addElement(LookupElementBuilder.create(pathPrefix + key)
@ -87,4 +85,5 @@ public class KeyCompletionProvider extends CompletionProvider<CompletionParamete
}
}
}
}
}