summaryrefslogtreecommitdiff
path: root/src/game/g_admin.c
diff options
context:
space:
mode:
authorTremulous Test Server <tremtest@d1stkfactory>2015-02-01 13:31:36 +0000
committerTremulous Test Server <tremtest@d1stkfactory>2015-02-01 13:31:36 +0000
commitab724678a4403f64d731cecbe9ded904af4310b6 (patch)
tree3610e38896eaae2d2defc00403342a27dfc36b60 /src/game/g_admin.c
parent48998ab22fc2b36a7c4a44ce697aa4315ea0be92 (diff)
Fixed a possible null pointer access in g_admin_find_level_for_score.
Diffstat (limited to 'src/game/g_admin.c')
-rw-r--r--src/game/g_admin.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 34e8b20..3b1566c 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -3840,9 +3840,10 @@ g_admin_level_t *G_admin_find_level_for_score( int score ) {
for( level = g_admin_levels; level; level = next )
{
next = level->next;
- if( next == NULL && level->score > 0) return level;
- if( next->score < 0 ) continue;
- if( /*level->score > score && */next->score <= score ) return next;
+ if( next != NULL) {
+ if( next->score < 0 ) continue;
+ if( /*level->score > score && */next->score <= score ) return next;
+ } else if (level->score > 0) return level;
}
return NULL;
}