]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/command/cl_cmd.qc
Fix application crash executing cl_cmd debugmodel without model name parameter
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / command / cl_cmd.qc
index 0f8a69e727d6b43c48bb9eaf17c6ed1a78029e20..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:
@@ -551,8 +554,6 @@ void GameCommand(string command)
 // Please add client commands to the function above this, as this is only for special reasons.
 // NOTE: showaccuracy is kept as legacy command
 #define CONSOLE_COMMANDS_NORMAL() \
-       CONSOLE_COMMAND("+showscores", { scoreboard_showscores = true; }) \
-       CONSOLE_COMMAND("-showscores", { scoreboard_showscores = false; }) \
        CONSOLE_COMMAND("+showaccuracy", { }) \
        CONSOLE_COMMAND("-showaccuracy", { }) \
        /* nothing */