perf ui hists: Guard against NULL hist_entry in add_script_opt()

In add_script_opt(), when the browser selection has no valid hist_entry
(for example, when all entries are filtered out or the trace is empty),
hist_browser__selected_entry() returns NULL.

Add an explicit check for he == NULL prior to accessing he->time to avoid a
potential NULL pointer dereference crash.

Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Ian Rogers 2026-07-22 21:59:45 -07:00 • committed by Namhyung Kim
commit 08b0cd02e9