diff options
author | Campbell Barton <ideasman42@gmail.com> | 2005-12-20 02:04:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2005-12-20 02:04:58 +0300 |
commit | bbb00043cdc8fd12c643ed622e333cc95cdd02a4 (patch) | |
tree | da487fc65b1bdef0d89cefbda04fe2e1a4382eb4 /source/blender/src/drawoops.c | |
parent | b05433a095d00f510f7edddbd6711636cc774e24 (diff) |
When adding a Mesh in python a file saved caused blender to segfault when reloading.
turns out that oops->id->lib isnt initialized? anyhow
if (oops->id && oops->id->lib) // works
where
if (oops->id->lib) // crashes
so made the needed change in a few places.
Diffstat (limited to 'source/blender/src/drawoops.c')
-rw-r--r-- | source/blender/src/drawoops.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/src/drawoops.c b/source/blender/src/drawoops.c index 4ecc31eb082..13e36dffefc 100644 --- a/source/blender/src/drawoops.c +++ b/source/blender/src/drawoops.c @@ -86,7 +86,7 @@ void boundbox_oops(short sel) oops= G.soops->oops.first; while(oops) { - if (oops->hide==0 && !sel || (sel && oops->flag & SELECT )) { + if ((oops->hide==0 && !sel) || (sel && oops->flag & SELECT )) { ok= 1; min[0]= MIN2(min[0], oops->x); @@ -131,7 +131,9 @@ void draw_oopslink(Oops *oops) if(oops->type==ID_SCE) { if(oops->flag & SELECT) { - if(oops->id->lib) cpack(0x4080A0); + /* when using python Mesh to make meshes a file was saved + that had an oops with no ID, stops a segfault when looking for lib */ + if(oops->id && oops->id->lib) cpack(0x4080A0); else cpack(0x808080); } else cpack(0x606060); @@ -345,7 +347,10 @@ void draw_oops(Oops *oops) glRectf(x1, y1, x2, y2); } - if(oops->id->lib) { + + /* it has never happened that an oops was missing an ID at + this point but has occured elseware so lets be safe */ + if(oops->id && oops->id->lib) { if(oops->id->flag & LIB_INDIRECT) cpack(0x1144FF); else cpack(0x11AAFF); |