diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-10-27 18:22:55 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-10-27 18:22:55 +0300 |
commit | 71260b6603b1edfdbae57bfaa7d7388af366b17e (patch) | |
tree | 19f211570023381cb6a1ef43b1db9d420bd1fe7f /source/blender/blenloader/intern | |
parent | 780a5438a2a24b6397ead881659af4442bdbb0ae (diff) |
Fix for crash reading a peach file, chubbychestnut.blend. A do_versions
conversion was reading the mtex array in a library linked material. It
is however not guaranteed that direct_link_* was called on the material
yet, so the array pointer is not always valid and it can crash.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index c2dcc86ae41..edb9c3ff898 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4921,6 +4921,12 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me) ma= newlibadr(fd, lib, me->mat[mf->mat_nr]); texalpha = 0; + /* we can't read from this if it comes from a library, + * because direct_link might not have happened on it, + * so ma->mtex is not pointing to valid memory yet */ + if(ma && ma->id.lib) + ma= NULL; + for(b=0; ma && b<MAX_MTEX; b++) if(ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA) texalpha = 1; |