]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix a possible crash, if vehicles and turrets are disabled. Similar issue #2703
authorLegendaryGuard <rootuser999@gmail.com>
Sat, 25 Jun 2022 11:04:13 +0000 (13:04 +0200)
committerLegendaryGuard <rootuser999@gmail.com>
Sat, 25 Jun 2022 11:04:13 +0000 (13:04 +0200)
qcsrc/common/mutators/mutator/nades/nades.qc

index 60faafe9acdc88c888b78a8d4b5a89ad8aac50a9..d215e9c8bec003b5a6cd66a14bb3268391516e65 100644 (file)
@@ -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;