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 ### Fixed
- Character unescaping for '.properties' files - Character unescaping for '.properties' files
- Exception on json files without any content
## [2.0.0] ## [2.0.0]
### BREAKING CHANGES ### BREAKING CHANGES

View File

@ -36,7 +36,9 @@ public class JsonParserStrategy extends ParserStrategy {
try(Reader reader = new InputStreamReader(vf.getInputStream(), vf.getCharset())) { try(Reader reader = new InputStreamReader(vf.getInputStream(), vf.getCharset())) {
JsonObject input = GSON.fromJson(reader, JsonObject.class); JsonObject input = GSON.fromJson(reader, JsonObject.class);
JsonMapper.read(file.getLocale(), input, targetNode); if(input != null) { // @input is null if file is completely empty
JsonMapper.read(file.getLocale(), input, targetNode);
}
} }
} }