From 63c1562608d62bac9e3c9917e7ee47b79aef73a5 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Fri, 23 Nov 2018 18:59:24 +0100 Subject: Fix a potential bug. --- src/game/g_admin.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/game') diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 93c1d54..cb42e31 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -10620,8 +10620,11 @@ qboolean G_admin_curse(gentity_t *ent, int skiparg) for (i = 0; i < level.maxclients; i++) memset(&level.clients[i].curses, 0, sizeof(adminCurses_t)); - G_AdminsPrintf("^3!curse: ^7reset by %s\n", - ent ? G_admin_adminPrintName(ent) : "console"); + if (ent) { + G_AdminsPrintf("^3!curse: ^7reset by %s\n", + G_admin_adminPrintName(ent)); + } + return qtrue; } @@ -10676,7 +10679,7 @@ qboolean G_admin_curse(gentity_t *ent, int skiparg) return qfalse; } - if (g_cheats.integer) + if (g_cheats.integer || !ent) goto skip_protection; if (G_admin_permission(target, ADMF_IMMUTABLE) || @@ -10715,9 +10718,12 @@ skip_protection: return qfalse; } - G_AdminsPrintf("^3!curse: ^7%s^7 cursed %s^7 with %s = %f\n", - ent ? G_admin_adminPrintName(ent) : "console", - target->client->pers.netname, arg_option, value); + if (ent) { + G_AdminsPrintf("^3!curse: ^7%s^7 cursed %s^7 with %s = %f\n", + G_admin_adminPrintName(ent), + target->client->pers.netname, arg_option, value); + } + return qtrue; } -- cgit