From 61a33e41daf980175e5f531f9883b6e3ff6db225 Mon Sep 17 00:00:00 2001 From: pancake Date: Sat, 7 Jun 2014 11:47:12 +0200 Subject: [PATCH] Fix 'ij' JSON output when no RBinInfo is found --- libr/core/bin.c | 6 +++++- libr/core/cmd_info.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libr/core/bin.c b/libr/core/bin.c index 99c1e21832..d7fca8b4f8 100644 --- a/libr/core/bin.c +++ b/libr/core/bin.c @@ -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\"," diff --git a/libr/core/cmd_info.c b/libr/core/cmd_info.c index 24906675a9..862e43042a 100644 --- a/libr/core/cmd_info.c +++ b/libr/core/cmd_info.c @@ -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)