diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-08-13 15:54:12 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-08-13 15:54:12 +0400 |
commit | 79a928682c9ae8241f265f90148da1aeb73c1650 (patch) | |
tree | 4460eefc57e153012521ecbd80ea2a57019430c3 /source/blender/editors/interface | |
parent | 5a3bd23e8eb0edfa189ff073338195fd056af763 (diff) |
2.5 - Fix for segfaults with entering text in normal number buttons (i.e. frame buttons in timeline header).
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a8703868ad1..bbdaad5fd5d 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1505,14 +1505,18 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) #ifndef DISABLE_PYTHON { - char str_unit_convert[256]; - int unit_type= RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop)); Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); - - + char str_unit_convert[256]; + int unit_type; + + if (but->rnaprop) + RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop)); + else + unit_type= 0; + if(scene->unit.system != USER_UNIT_NONE && unit_type) { /* ugly, use the draw string to get the value, this could cause problems if it includes some text which resolves to a unit */ - bUnit_ReplaceString(str_unit_convert, str, but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type); + bUnit_ReplaceString(str_unit_convert, (char *)str, but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type); } else { strcpy(str_unit_convert, str); |