diff options
author | NRK <nrk@disroot.org> | 2023-01-28 11:27:40 +0100 |
---|---|---|
committer | NRK <nrk@disroot.org> | 2023-01-28 11:27:40 +0100 |
commit | 01f3cf2e4778940a82001e48cfeec767841f52c4 (patch) | |
tree | 7d61272eb5c71935238d0ecd52b2806398564fce /window.c | |
parent | 6ffc64a04e5e4200103db9df6bd85f958a942d9f (diff) | |
download | nsxiv-01f3cf2e4778940a82001e48cfeec767841f52c4.tar.zst |
use assertions instead of ignoring bogus arguments (#406)
instead of silently ignoring bogus arguments (i.e programming errors),
which can make debugging harder, it's better to assert them so that they
get caught faster in debug builds.
Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/406
Reviewed-by: explosion-mental <explosion-mental@noreply.codeberg.org>
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -22,6 +22,7 @@ #include "config.h" #include "icon/data.h" +#include <assert.h> #include <locale.h> #include <stdlib.h> #include <string.h> @@ -450,10 +451,10 @@ static void win_draw_bar(win_t *win) win_bar_t *l, *r; XftDraw *d; - if ((l = &win->bar.l)->buf == NULL || (r = &win->bar.r)->buf == NULL) - return; - e = &win->env; + l = &win->bar.l; + r = &win->bar.r; + assert(l->buf != NULL && r->buf != NULL); y = (win->bar.top ? 0 : win->h) + font->ascent + V_TEXT_PAD; w = win->w - 2*H_TEXT_PAD; d = XftDrawCreate(e->dpy, win->buf.pm, e->vis, e->cmap); |