fix for crash while appending data. (missing NULL check for newlibadr return value)
authorCampbell Barton <ideasman42@gmail.com>
Fri, 7 Aug 2009 05:25:17 +0000 (05:25 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 7 Aug 2009 05:25:17 +0000 (05:25 +0000)
source/blender/blenloader/intern/readfile.c

index 60559cc2d8d173b6d68dc67041e6ae42f2c6f84a..6bcb110948085087f32f6a3f29dfd43222b804ba 100644 (file)
@@ -9363,10 +9363,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        /* set new bump for unused slots */
                        for(a=0; a<MAX_MTEX; a++) {
                                if(ma->mtex[a]) {
-                                       if(!ma->mtex[a]->tex)
-                                               ma->mtex[a]->texflag |= MTEX_NEW_BUMP;
-                                       else if(((Tex*)newlibadr(fd, ma->id.lib, ma->mtex[a]->tex))->type == 0)
+                                       tex= ma->mtex[a]->tex;
+                                       if(!tex)
                                                ma->mtex[a]->texflag |= MTEX_NEW_BUMP;
+                                       else {
+                                               tex= (Tex*)newlibadr(fd, ma->id.lib, tex);
+                                               if(tex && tex->type == 0) /* invalid type */
+                                                       ma->mtex[a]->texflag |= MTEX_NEW_BUMP;
+                                       }
                                }
                        }
                }