From: divverent Date: Sun, 1 Apr 2012 13:20:46 +0000 (+0000) Subject: fix a NULL pointer dereference in modeldecompile X-Git-Tag: xonotic-v0.7.0~178 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4cca9f4389de3aa12fe283de0a3f315feb83e915;p=xonotic%2Fdarkplaces.git fix a NULL pointer dereference in modeldecompile git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11777 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=72aa3ea5c69b7b504c1ff1b678720a36e6d4c806 --- diff --git a/model_shared.c b/model_shared.c index 5c000bfa..d9948aea 100644 --- a/model_shared.c +++ b/model_shared.c @@ -3359,6 +3359,11 @@ static void Mod_Decompile_f(void) FS_StripExtension(inname, basename, sizeof(basename)); mod = Mod_ForName(inname, false, true, inname[0] == '*' ? cl.model_name[1] : NULL); + if (!mod) + { + Con_Print("No such model\n"); + return; + } if (mod->brush.submodel) { // if we're decompiling a submodel, be sure to give it a proper name based on its parent @@ -3366,11 +3371,6 @@ static void Mod_Decompile_f(void) dpsnprintf(basename, sizeof(basename), "%s/%s", outname, mod->name); outname[0] = 0; } - if (!mod) - { - Con_Print("No such model\n"); - return; - } if (!mod->surfmesh.num_triangles) { Con_Print("Empty model (or sprite)\n");