Skip to content

Commit

Permalink
Make case of no JSON found an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Nov 23, 2024
1 parent 8e5367c commit 88bb018
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion librz/core/cmd/cmd_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -3479,7 +3479,9 @@ RZ_IPI RzCmdStatus rz_print_current_block_json_handler(RzCore *core, int argc, c
bool enable_color = rz_config_get_i(core->config, "escr.color") != 0;
char *res = rz_print_json_indent((const char *)core->block, enable_color, " ", NULL);
if (RZ_STR_ISEMPTY(res)) {
rz_cons_printf("Couldn't find a JSON string.\n");
free(res);
RZ_LOG_ERROR("Couldn't find a JSON string.\n");
return RZ_CMD_STATUS_ERROR;
} else {
rz_cons_printf("%s\n", res);
}
Expand Down
3 changes: 1 addition & 2 deletions test/db/cmd/print
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,5 @@ EXPECT=<<EOF
"b": 0
}
}
Couldn't find a JSON string.
EOF
EOF
RUN

0 comments on commit 88bb018

Please sign in to comment.