From 53f046bd9ba0374249dc038504a3f61d1cf9765a Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sat, 23 Jul 2022 22:10:45 -0400 Subject: [PATCH] FIX nil makes interface crash when pid not found --- src/modules/processor.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/processor.lua b/src/modules/processor.lua index e563e26..78036e7 100644 --- a/src/modules/processor.lua +++ b/src/modules/processor.lua @@ -206,8 +206,9 @@ return function(update_freq, config, main_state, common, width, point) local update = function() for r = 1, num_rows do local pid = i_o.conky(table_conky[r].pid, '(%d+)') -- may have leading spaces + local name = i_o.read_file('/proc/'..pid..'/comm', '(%C+)') or 'N/A' if pid ~= '' then - text_table.set(tbl, 1, r, i_o.read_file('/proc/'..pid..'/comm', '(%C+)')) + text_table.set(tbl, 1, r, name) text_table.set(tbl, 2, r, pid) text_table.set(tbl, 3, r, i_o.conky(table_conky[r].cpu)) end