diff --git a/libr/core/graph.c b/libr/core/graph.c index bf28fa49e1..420583161e 100644 --- a/libr/core/graph.c +++ b/libr/core/graph.c @@ -2338,11 +2338,7 @@ R_API int r_core_visual_graph(RCore *core, RAnalFunction *_fcn, int is_interacti grd->core = core; grd->fcn = &fcn; ret = agraph_refresh (grd); - if (!ret) { - is_error = R_TRUE; - } - - if (is_interactive) { + if (ret && is_interactive) { // set current node based on the current offset ut64 bbaddr = r_core_anal_get_bbaddr (core, core->offset); if (r_anal_fcn_is_in_offset (fcn, bbaddr)) { @@ -2353,6 +2349,10 @@ R_API int r_core_visual_graph(RCore *core, RAnalFunction *_fcn, int is_interacti set_curnode (g, an->gnode); agraph_update_seek (g, an, R_TRUE); } + } else { + r_cons_newline (); + exit_graph = R_TRUE; + is_error = !ret; } core->cons->event_data = grd; @@ -2366,12 +2366,6 @@ R_API int r_core_visual_graph(RCore *core, RAnalFunction *_fcn, int is_interacti break; } - if (!is_interactive) { - /* this is a non-interactive ascii-art graph, so exit the loop */ - r_cons_newline (); - break; - } - r_cons_show_cursor(R_FALSE); wheel = r_config_get_i (core->config, "scr.wheel"); if (wheel)