[iortcw] 275/497: All: Make Window_Paint check if w is NULL before dereference
Simon McVittie
smcv at debian.org
Fri Sep 8 10:37:06 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit 4a9d5aea494ba330009109b4917df649dba0d281
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Tue Jan 13 23:17:03 2015 +0000
All: Make Window_Paint check if w is NULL before dereference
---
MP/code/ui/ui_shared.c | 10 ++++++++--
SP/code/ui/ui_shared.c | 10 ++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/MP/code/ui/ui_shared.c b/MP/code/ui/ui_shared.c
index 569905c..1564c84 100644
--- a/MP/code/ui/ui_shared.c
+++ b/MP/code/ui/ui_shared.c
@@ -663,17 +663,23 @@ void Fade( int *flags, float *f, float clamp, int *nextTime, int offsetTime, qbo
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;
diff --git a/SP/code/ui/ui_shared.c b/SP/code/ui/ui_shared.c
index 591394f..e258082 100644
--- a/SP/code/ui/ui_shared.c
+++ b/SP/code/ui/ui_shared.c
@@ -717,17 +717,23 @@ void Fade( int *flags, float *f, float clamp, int *nextTime, int offsetTime, qbo
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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list