diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-12 03:08:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-12 03:08:17 +0400 |
commit | 4750f24663cc4077861de80a38dcd21af781f30d (patch) | |
tree | 1d6a295977937272be7a85cc98b494431bac3dd5 /source/blender/editors/curve | |
parent | 6b2dd62c64638b97ae9b3164a69dc143a31447cd (diff) |
fix for crash caused by invalid active material index while editing text.
also added some better error checking in object_remove_material_slot() so it will print an error rather then crashing if this case ever happens again.
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r-- | source/blender/editors/curve/editfont.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index d8257c524c1..19892d2c1ee 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -264,9 +264,16 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re EditFont *ef= cu->editfont; cu->curinfo = ef->textbufinfo[cu->pos?cu->pos-1:0]; - if(obedit->totcol>0) + if(obedit->totcol > 0) { obedit->actcol= ef->textbufinfo[cu->pos?cu->pos-1:0].mat_nr; + /* since this array is calloc'd, it can be 0 even though we try ensure + * (mat_nr > 0) almost everywhere */ + if (obedit->actcol < 1) { + obedit->actcol= 1; + } + } + if(mode == FO_EDIT) update_string(cu); |