Skip to content

Commit

Permalink
Prevent model server crash if data is missing in metadata file during…
Browse files Browse the repository at this point in the history
… callHome
  • Loading branch information
maaquib committed Oct 3, 2023
1 parent 27c6a57 commit 36d5af0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/src/main/java/ai/djl/util/Ec2Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private static String readEndpointMetadata(String key) {
Path path = Paths.get(ENDPOINT_METADATA_FILE);
try (Reader reader = Files.newBufferedReader(path)) {
JsonObject json = JsonUtils.GSON.fromJson(reader, JsonObject.class);
return json.get(key).getAsString();
return (json.get(key) != null) ? json.get(key).getAsString() : null;
} catch (IOException e) {
// ignore
}
Expand Down

0 comments on commit 36d5af0

Please sign in to comment.