Skip to content

Commit

Permalink
Make Window_Paint check if w is NULL before dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
zturtleman committed Jan 13, 2015
1 parent 84e792f commit 78e7656
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code/ui/ui_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 78e7656

Please sign in to comment.