fix a possible bug that can cause ds->shaderInfo to be NULL
authorRudolf Polzer <divverent@xonotic.org>
Sun, 5 Jun 2011 16:43:31 +0000 (18:43 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sun, 5 Jun 2011 16:43:31 +0000 (18:43 +0200)
tools/quake3/q3map2/model.c

index a56134c..c4d34d7 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;