]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed empty texture lump handling in q1bsp loading
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 15 Sep 2003 02:21:50 +0000 (02:21 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 15 Sep 2003 02:21:50 +0000 (02:21 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3462 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c

index d63e9003e230cf8d73a4737adbde42ca89244f70..d6a220eabc12215bbf94a8ef803769854b23a87a 100644 (file)
@@ -737,15 +737,19 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l)
 
        loadmodel->brushq1.textures = NULL;
 
-       if (!l->filelen)
-               return;
-
-       m = (dmiptexlump_t *)(mod_base + l->fileofs);
-
-       m->nummiptex = LittleLong (m->nummiptex);
-
        // add two slots for notexture walls and notexture liquids
-       loadmodel->brushq1.numtextures = m->nummiptex + 2;
+       if (l->filelen)
+       {
+               m = (dmiptexlump_t *)(mod_base + l->fileofs);
+               m->nummiptex = LittleLong (m->nummiptex);
+               loadmodel->brushq1.numtextures = m->nummiptex + 2;
+       }
+       else
+       {
+               m = NULL;
+               loadmodel->brushq1.numtextures = 2;
+       }
+
        loadmodel->brushq1.textures = Mem_Alloc(loadmodel->mempool, loadmodel->brushq1.numtextures * sizeof(texture_t));
 
        // fill out all slots with notexture
@@ -766,6 +770,9 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l)
                tx->currentframe = tx;
        }
 
+       if (!m)
+               return;
+
        // just to work around bounds checking when debugging with it (array index out of bounds error thing)
        dofs = m->dataofs;
        // LordHavoc: mostly rewritten map texture loader