Fix 'ij' JSON output when no RBinInfo is found

This commit is contained in:
pancake 2014-06-07 11:47:12 +02:00
parent b788deac00
commit 61a33e41da
2 changed files with 6 additions and 2 deletions

View File

@ -198,7 +198,11 @@ static int bin_info (RCore *r, int mode) {
char str[R_FLAG_NAME_SIZE];
RBinInfo *info = r_bin_get_info (r->bin);
RBinFile *binfile = r_core_bin_cur (r);
if (!info) return R_FALSE;
if (!info) {
if (mode & R_CORE_BIN_JSON)
r_cons_printf ("{}");
return R_FALSE;
}
if (mode & R_CORE_BIN_JSON) {
r_cons_printf ("{\"type\":\"%s\","

View File

@ -79,7 +79,7 @@ static void r_core_file_info (RCore *core, int mode) {
static void cmd_info_bin(RCore *core, ut64 offset, int va, int mode) {
if (core->file) {
if (mode == R_CORE_BIN_JSON)
r_cons_printf ("{\"bin\":{");
r_cons_printf ("{\"bin\":");
r_core_bin_info (core, R_CORE_BIN_ACC_INFO,
mode, va, NULL, offset);
if (mode == R_CORE_BIN_JSON)