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
commit 718a45ef71
Notes: sideshowbarker 2024-07-19 04:11:33 +09:00

View file

@ -66,7 +66,10 @@ int main(int argc, char** argv)
auto file_contents = file->read_all();
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());
printf("\n");