From: terencehill Date: Sat, 13 May 2023 21:39:50 +0000 (+0200) Subject: Fix application crash executing cl_cmd debugmodel without model name parameter X-Git-Tag: xonotic-v0.8.6~109 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1c949c25da2f6bd609caa4a261b19f8366e97e8e;p=xonotic%2Fxonotic-data.pk3dir.git Fix application crash executing cl_cmd debugmodel without model name parameter --- diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index 93825b086..45f15d3a1 100644 --- a/qcsrc/client/command/cl_cmd.qc +++ b/qcsrc/client/command/cl_cmd.qc @@ -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: