diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-12-03 12:32:54 +0100 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2020-12-03 12:32:54 +0100 |
commit | 3695cbd5d8dda27f99383437035450814463b633 (patch) | |
tree | bf591b158a801daf183fdfa3a1a3c3f03d42e0de | |
parent | fe848403149dd8e452281ec8eb16a8401112b0f6 (diff) |
Silence possible NULL dereference
Found by compiling with LTO
ProcessList.c: In function ‘ProcessList_updateTreeSetLayer’:
ProcessList.c:195:15: error: potential null pointer dereference [-Werror=null-dereference]
195 | if (proc->tree_depth == deep && proc->tree_left > left && proc->tree_right < right) {
| ^
ProcessList.c:195:15: error: potential null pointer dereference [-Werror=null-dereference]
ProcessList.c:195:15: error: potential null pointer dereference [-Werror=null-dereference]
-rw-r--r-- | ProcessList.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ProcessList.c b/ProcessList.c index 59a7c387..fb4ba481 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -192,7 +192,8 @@ static void ProcessList_updateTreeSetLayer(ProcessList* this, unsigned int leftB // 4 | 6 | 7 for (unsigned int i = leftBound; i < rightBound; i++) { Process* proc = (Process*)Hashtable_get(this->displayTreeSet, i); - if (proc->tree_depth == deep && proc->tree_left > left && proc->tree_right < right) { + assert(proc); + if (proc && proc->tree_depth == deep && proc->tree_left > left && proc->tree_right < right) { if (Vector_size(layer) > 0) { Process* previous_process = (Process*)Vector_get(layer, Vector_size(layer) - 1); |