Coverity: Forward NULL: CID 44, 43, 36
authorNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 20 Jan 2012 17:41:16 +0000 (12:41 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 20 Jan 2012 17:41:16 +0000 (12:41 -0500)
* src/ui/window.c (window_display_buffer): Make sure t is only
dereference if not NULL even in case of fatal crash.

* src/ui/window.c (set_window_display_buffer): Ditto.
* src/ui/window.c (window_display_lines): Ditto.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/ui/window.c

index 287b1c8..8ee614b 100644 (file)
@@ -561,8 +561,7 @@ display_line_dynarr *window_display_lines(struct window * w, int which)
        t = find_window_mirror(w);
        if (!t)
                abort();
-
-       if (which == CURRENT_DISP)
+       else if (which == CURRENT_DISP)
                return t->current_display_lines;
        else if (which == DESIRED_DISP)
                return t->desired_display_lines;
@@ -584,8 +583,8 @@ struct buffer *window_display_buffer(struct window *w)
        t = find_window_mirror(w);
        if (!t)
                abort();
-
-       return t->buffer;
+       else
+               return t->buffer;
 }
 
 void set_window_display_buffer(struct window *w, struct buffer *b)
@@ -597,8 +596,8 @@ void set_window_display_buffer(struct window *w, struct buffer *b)
        t = find_window_mirror(w);
        if (!t)
                abort();
-
-       t->buffer = b;
+       else 
+               t->buffer = b;
 }
 \f
 /* Determining a window's position based solely on its pixel