0
0
Fork 0
mirror of https://github.com/UberGames/ioef.git synced 2025-02-28 22:21:48 +00:00

Make Window_Paint check if w is NULL before dereference

This commit is contained in:
Zack Middleton 2015-01-12 20:24:41 -06:00
parent 84e792f453
commit 78e7656900

View file

@ -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) { void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle) {
//float bordersize = 0; //float bordersize = 0;
vec4_t color = {0}; vec4_t color = {0};
rectDef_t fillRect = w->rect; rectDef_t fillRect;
if ( w == NULL ) {
return;
}
if (debugMode) { if (debugMode) {
color[0] = color[1] = color[2] = color[3] = 1; 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); 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; return;
} }
fillRect = w->rect;
if (w->border != 0) { if (w->border != 0) {
fillRect.x += w->borderSize; fillRect.x += w->borderSize;
fillRect.y += w->borderSize; fillRect.y += w->borderSize;