From 72aa3ea5c69b7b504c1ff1b678720a36e6d4c806 Mon Sep 17 00:00:00 2001 From: divverent Date: Sun, 1 Apr 2012 13:20:46 +0000 Subject: [PATCH] fix a NULL pointer dereference in modeldecompile git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11777 d7cf8633-e32d-0410-b094-e92efae38249 --- model_shared.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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"); -- 2.39.2