From df4a41ff8190235c389af768a5bb0375c5840c6c Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 2 Dec 2018 14:53:26 -0800 Subject: [PATCH] Fix a crash with -d5 and block processes --- src/proc.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/proc.h b/src/proc.h index f5d1abc95..99b3b2c26 100644 --- a/src/proc.h +++ b/src/proc.h @@ -203,7 +203,12 @@ class job_t { /// untruncated job string when we don't care what the job is, only which of the currently /// running jobs it is. wcstring preview() const { - return processes.empty() ? L"" : processes[0]->argv0() + wcstring(L" ..."); + if (processes.empty()) + return L""; + // Note argv0 may be empty in e.g. a block process. + const wchar_t *argv0 = processes.front()->argv0(); + wcstring result = argv0 ? argv0 : L"null"; + return result + L" ..."; } /// All the processes in this job.