]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix application crash executing cl_cmd debugmodel without model name parameter
authorterencehill <piuntn@gmail.com>
Sat, 13 May 2023 21:39:50 +0000 (23:39 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 13 May 2023 21:39:50 +0000 (23:39 +0200)
qcsrc/client/command/cl_cmd.qc

index 93825b086d5cefdbaa3875af30dc217392b0e556..45f15d3a191a373b11cda9fa34ac0cf6a2d4ad2a 100644 (file)
@@ -176,15 +176,18 @@ void LocalCommand_debugmodel(int request, int argc)
                {
                        string modelname = argv(1);
 
-                       entity debugmodel_entity = new(debugmodel);
-                       precache_model(modelname);
-                       _setmodel(debugmodel_entity, modelname);
-                       setorigin(debugmodel_entity, view_origin);
-                       debugmodel_entity.angles = view_angles;
-                       debugmodel_entity.draw = DrawDebugModel;
-                       IL_PUSH(g_drawables, debugmodel_entity);
-
-                       return;
+                       if (modelname != "")
+                       {
+                               entity debugmodel_entity = new(debugmodel);
+                               precache_model(modelname);
+                               _setmodel(debugmodel_entity, modelname);
+                               setorigin(debugmodel_entity, view_origin);
+                               debugmodel_entity.angles = view_angles;
+                               debugmodel_entity.draw = DrawDebugModel;
+                               IL_PUSH(g_drawables, debugmodel_entity);
+                               return;
+                       }
+                       // fall through
                }
 
                default: