From 78e765690015b93853235f2d7d492d14ed70a649 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Mon, 12 Jan 2015 20:24:41 -0600 Subject: [PATCH] Make Window_Paint check if w is NULL before dereference --- code/ui/ui_shared.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/ui/ui_shared.c b/code/ui/ui_shared.c index a5f8582c..dc9f3af2 100644 --- a/code/ui/ui_shared.c +++ b/code/ui/ui_shared.c @@ -609,18 +609,23 @@ void Fade(int *flags, float *f, float clamp, int *nextTime, int offsetTime, qboo void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle) { //float bordersize = 0; vec4_t color = {0}; - rectDef_t fillRect = w->rect; + rectDef_t fillRect; + if ( w == NULL ) { + return; + } if (debugMode) { color[0] = color[1] = color[2] = color[3] = 1; DC->drawRect(w->rect.x, w->rect.y, w->rect.w, w->rect.h, 1, color); } - if (w == NULL || (w->style == 0 && w->border == 0)) { + if (w->style == 0 && w->border == 0) { return; } + fillRect = w->rect; + if (w->border != 0) { fillRect.x += w->borderSize; fillRect.y += w->borderSize;