]> git.rm.cloudns.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)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 3 Apr 2012 17:03:59 +0000 (19:03 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11777 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=72aa3ea5c69b7b504c1ff1b678720a36e6d4c806

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");