Bugfix #13649: Segmentation fault when deleting object

When the IPO editor was pinned, and the active object was changed, deleting the active object would cause a crash.
This commit is contained in:
Joshua Leung 2008-06-08 09:35:05 +00:00
parent 7e095fa695
commit 08f9bcf8ec

@ -1712,7 +1712,7 @@ static void boundbox_ipo_curves(SpaceIpo *si)
/* is used for both read and write... */ /* is used for both read and write... */
static void ipo_editvertex_buts(uiBlock *block, SpaceIpo *si, float min, float max) static void ipo_editvertex_buts(uiBlock *block, SpaceIpo *si, float min, float max)
{ {
Object *ob= OBACT; Object *ob;
EditIpo *ei; EditIpo *ei;
BezTriple *bezt; BezTriple *bezt;
float median[3]; float median[3];
@ -1721,6 +1721,12 @@ static void ipo_editvertex_buts(uiBlock *block, SpaceIpo *si, float min, float m
median[0]= median[1]= median[2]= 0.0; median[0]= median[1]= median[2]= 0.0;
tot= 0; tot= 0;
/* use G.sipo->from (which should be an object) so that pinning ipo's will still work ok */
if((G.sipo->from) && (GS(G.sipo->from->name) == ID_OB))
ob= (Object *)(G.sipo->from);
else
ob= OBACT;
ei= G.sipo->editipo; ei= G.sipo->editipo;
for(a=0; a<G.sipo->totipo; a++, ei++) { for(a=0; a<G.sipo->totipo; a++, ei++) {