From ab724678a4403f64d731cecbe9ded904af4310b6 Mon Sep 17 00:00:00 2001 From: Tremulous Test Server Date: Sun, 1 Feb 2015 13:31:36 +0000 Subject: Fixed a possible null pointer access in g_admin_find_level_for_score. --- src/game/g_admin.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/game') 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; } -- cgit