]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix a NULL pointer dereference in modeldecompile
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 1 Apr 2012 13:20:46 +0000 (13:20 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 1 Apr 2012 13:20:46 +0000 (13:20 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11777 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index 5c000bfa7ba0e53bc4d4433456c80aa9739fafbc..d9948aeab8ba7d5e413b11ce616049ff063af5e8 100644 (file)
@@ -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");