From 7277d8d6e7a5873cf5694e58a1be8cb7bcea0248 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Mon, 1 Sep 2014 13:03:06 +0100 Subject: [PATCH] Fix more warnings --- code/game/ai_vcmd.c | 4 ++-- code/game/g_items.c | 6 +++++- code/renderergl2/tr_bsp.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/code/game/ai_vcmd.c b/code/game/ai_vcmd.c index 93db55f4..a274bca7 100644 --- a/code/game/ai_vcmd.c +++ b/code/game/ai_vcmd.c @@ -527,13 +527,13 @@ int BotVoiceChatCommand(bot_state_t *bs, int mode, char *voiceChat) { Q_strncpyz(buf, voiceChat, sizeof(buf)); cmd = buf; - for (ptr = cmd; *cmd && *cmd > ' '; cmd++); + for (; *cmd && *cmd > ' '; cmd++); while (*cmd && *cmd <= ' ') *cmd++ = '\0'; //voiceOnly = atoi(ptr); for (ptr = cmd; *cmd && *cmd > ' '; cmd++); while (*cmd && *cmd <= ' ') *cmd++ = '\0'; clientNum = atoi(ptr); - for (ptr = cmd; *cmd && *cmd > ' '; cmd++); + for (; *cmd && *cmd > ' '; cmd++); while (*cmd && *cmd <= ' ') *cmd++ = '\0'; //color = atoi(ptr); diff --git a/code/game/g_items.c b/code/game/g_items.c index da8b7a8a..59461d1e 100644 --- a/code/game/g_items.c +++ b/code/game/g_items.c @@ -368,10 +368,14 @@ void RespawnItem( gentity_t *ent ) { choice = rand() % count; - for (count = 0, ent = master; count < choice; ent = ent->teamchain, count++) + for (count = 0, ent = master; ent && count < choice; ent = ent->teamchain, count++) ; } + if (!ent) { + return; + } + ent->r.contents = CONTENTS_TRIGGER; ent->s.eFlags &= ~EF_NODRAW; ent->r.svFlags &= ~SVF_NOCLIENT; diff --git a/code/renderergl2/tr_bsp.c b/code/renderergl2/tr_bsp.c index d80a6524..b658d987 100644 --- a/code/renderergl2/tr_bsp.c +++ b/code/renderergl2/tr_bsp.c @@ -1614,7 +1614,7 @@ int R_StitchPatches( int grid1num, int grid2num ) { } for (m = 0; m < 2; m++) { - if (grid2->height >= MAX_GRID_SIZE) + if (!grid2 || grid2->height >= MAX_GRID_SIZE) break; if (m) offset2 = grid2->width-1; else offset2 = 0;