found by cppcheck

src/window.c:2008:7: warning: Either the condition 'w' is redundant or there is 
possible null pointer dereference: w. [nullPointerRedundantCheck]
---
 src/window.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/window.c b/src/window.c
index 042d152..4294df4 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2005,7 +2005,7 @@ Window *GetWindowByNumber(uint16_t n)
                        while (w && w->w_number > n)
                                w = w->w_prev;
                }
-               if (w->w_number == n)
+               if (w && w->w_number == n)
                        return w;
        }
        return NULL;
-- 
2.49.0


Reply via email to