1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:57:35 +00:00

Userland: Handle invalid JSON in 'jp'

This commit is contained in:
Linus Groh 2020-08-05 21:15:52 +02:00 committed by Andreas Kling
parent f4f3ab0ad9
commit 718a45ef71

View file

@ -66,7 +66,10 @@ int main(int argc, char** argv)
auto file_contents = file->read_all(); auto file_contents = file->read_all();
auto json = JsonValue::from_string(file_contents); auto json = JsonValue::from_string(file_contents);
ASSERT(json.has_value()); if (!json.has_value()) {
fprintf(stderr, "Couldn't parse %s as JSON\n", path);
return 1;
}
print(json.value()); print(json.value());
printf("\n"); printf("\n");