From: LegendaryGuard Date: Sat, 25 Jun 2022 11:04:13 +0000 (+0200) Subject: Fix a possible crash, if vehicles and turrets are disabled. Similar issue #2703 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e2e17392762d125e300c53511f6cf26ff42b9823;p=xonotic%2Fxonotic-data.pk3dir.git Fix a possible crash, if vehicles and turrets are disabled. Similar issue #2703 --- diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 60faafe9ac..d215e9c8be 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -995,6 +995,9 @@ void nade_emerald_boom(entity this) { case 1: { + if(!autocvar_g_vehicles) + return; + if (vehspawncount < autocvar_g_nades_emerald_vehiclespawnlimit) { e = spawnvehicle( @@ -1009,6 +1012,9 @@ void nade_emerald_boom(entity this) true ); + if(!e) + return; // vehicle failed to be spawned + vehspawncount++; return; } @@ -1018,6 +1024,9 @@ void nade_emerald_boom(entity this) } case 2: { + if(!autocvar_g_turrets) + return; + if (turspawncount < autocvar_g_nades_emerald_turretspawnlimit) { e = spawnturret( @@ -1033,6 +1042,9 @@ void nade_emerald_boom(entity this) 1, true ); + + if(!e) + return; // turret failed to be spawned turspawncount++; return;