[PATCH] perf c2c report: Fix crash for empty browser
From: Jiri Olsa
Date: Tue Jul 24 2018 - 02:20:22 EST
Do not try to display entry details if there's
not any. Currently this ends up in crash:
$ perf c2c report
perf: Segmentation fault
Reported-by: rodia@xxxxxxxxxxxxx
Link: http://lkml.kernel.org/n/tip-3d7qjz9x49ay9ncerfordcv3@xxxxxxxxxxxxxx
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/builtin-c2c.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index f2ea85ee573f..f3aa9d02a5ab 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -2349,6 +2349,9 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
" s Toggle full length of symbol and source line columns \n"
" q Return back to cacheline list \n";
+ if (!he)
+ return 0;
+
/* Display compact version first. */
c2c.symbol_full = false;
--
2.17.1