fix npe on files with no content
This commit is contained in:
parent
9b6f1f8d25
commit
f749715f14
@ -15,6 +15,7 @@
|
||||
|
||||
### Fixed
|
||||
- Character unescaping for '.properties' files
|
||||
- Exception on json files without any content
|
||||
|
||||
## [2.0.0]
|
||||
### BREAKING CHANGES
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user