]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/model.c
fix a possible bug that can cause ds->shaderInfo to be NULL
[xonotic/netradiant.git] / tools / quake3 / q3map2 / model.c
index a56134c82777066c33851d4a8e33f60e6ad6c22a..c4d34d710194d209c9d3ebc70f2b0266d6f6ce6c 100644 (file)
@@ -333,12 +333,6 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap
                if( PicoGetSurfaceType( surface ) != PICO_TRIANGLES )
                        continue;
                
-               /* allocate a surface (ydnar: gs mods) */
-               ds = AllocDrawSurface( SURFACE_TRIANGLES );
-               ds->entityNum = eNum;
-               ds->castShadows = castShadows;
-               ds->recvShadows = recvShadows;
-               
                /* get shader name */
         shader = PicoGetSurfaceShader( surface );
                if( shader == NULL )
@@ -401,6 +395,12 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap
                else
                        si = ShaderInfoForShader( picoShaderName );
                
+               /* allocate a surface (ydnar: gs mods) */
+               ds = AllocDrawSurface( SURFACE_TRIANGLES );
+               ds->entityNum = eNum;
+               ds->castShadows = castShadows;
+               ds->recvShadows = recvShadows;
+
                /* set shader */
                ds->shaderInfo = si;