fix npe on files with no content

This commit is contained in:
marhali 2022-02-03 17:04:36 +01:00
parent 9b6f1f8d25
commit f749715f14
2 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,7 @@
### Fixed
- Character unescaping for '.properties' files
- Exception on json files without any content
## [2.0.0]
### BREAKING CHANGES

View File

@ -36,9 +36,11 @@ public class JsonParserStrategy extends ParserStrategy {
try(Reader reader = new InputStreamReader(vf.getInputStream(), vf.getCharset())) {
JsonObject input = GSON.fromJson(reader, JsonObject.class);
if(input != null) { // @input is null if file is completely empty
JsonMapper.read(file.getLocale(), input, targetNode);
}
}
}
@Override
public void write(@NotNull TranslationData data, @NotNull TranslationFile file) throws IOException {