Fix a crash with -d5 and block processes

This commit is contained in:
ridiculousfish 2018-12-02 14:53:26 -08:00
parent 335c41f097
commit df4a41ff81

View File

@ -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.