diff options
author | Stefan Gartner <stefang@aon.at> | 2003-05-14 04:23:58 +0400 |
---|---|---|
committer | Stefan Gartner <stefang@aon.at> | 2003-05-14 04:23:58 +0400 |
commit | c760bd6e3cd4a16a4a17f9e7f718c2c9e67e9be2 (patch) | |
tree | f3955b5b0420d7b43453a220aa7aa1fa2f8db5c7 /source/blender/src/toolbox.c | |
parent | 1bcb3b251e6b0f4fc95b9179005339f7178f67eb (diff) |
don't crash when adding an object after the previously selected object
has been deleted (thanks to Bischofftep for pointing this out)
Diffstat (limited to 'source/blender/src/toolbox.c')
-rw-r--r-- | source/blender/src/toolbox.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index c9c77ee4858..0b41ef47cc8 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -568,11 +568,11 @@ void tbox_execute(void) unsigned short qual1=0, qual2=0; /* needed to check for valid selected objects */ - Base *base; - Object *ob; + Base *base=NULL; + Object *ob=NULL; base= BASACT; - ob= base->object; + if (base) ob= base->object; if(tbfunc) { tbfunc(tbval); @@ -598,11 +598,12 @@ void tbox_execute(void) /* ctrl-s (Shear): switch into editmode ### */ else if(strcmp(tbstr1, "c|s")==0) { /* check that a valid object is selected to prevent crash */ - if ((ob->type==OB_LAMP) || (ob->type==OB_EMPTY) || (ob->type==OB_FONT) || (ob->type==OB_CAMERA)) { + if(!ob) error("Only selected objects can be sheared"); + else if ((ob->type==OB_LAMP) || (ob->type==OB_EMPTY) || (ob->type==OB_FONT) || (ob->type==OB_CAMERA)) { error("Only editable 3D objects can be sheared"); } else if ((base->lay & G.vd->lay)==0) { - error("Only objects on visible layers can be warped"); + error("Only objects on visible layers can be sheared"); } else { if (!G.obedit) { @@ -619,8 +620,9 @@ void tbox_execute(void) } } else if(strcmp(tbstr1, "W")==0) { + if (!ob) error ("Only selected objects can be warped"); /* check that a valid object is selected to prevent crash */ - if ((ob->type==OB_LAMP) || (ob->type==OB_EMPTY) || (ob->type==OB_FONT) || (ob->type==OB_CAMERA)) { + else if ((ob->type==OB_LAMP) || (ob->type==OB_EMPTY) || (ob->type==OB_FONT) || (ob->type==OB_CAMERA)) { error("Only editable 3D objects can be warped"); } else if ((base->lay & G.vd->lay)==0) { |