Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-02-27 11:29:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-27 11:30:06 +0400
commit118d86aa73f7113487fda5230a9f932001405312 (patch)
tree9426ffa31132be0915573a8b65efb2173af7a537
parent4622fc418ed0865d9f6bc169e3bfa25f3265a6b1 (diff)
UI: avoid for divide by zero for icon buttons (no need to clip text)
-rw-r--r--source/blender/editors/interface/interface_widgets.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 80e6cb9c8a4..b4aeef7b01b 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -956,7 +956,7 @@ static void ui_text_clip_left(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
but->ofs = 0;
but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr, sizeof(but->drawstr));
- if (but->strwidth > okwidth) {
+ if ((okwidth > 0.0f) && (but->strwidth > okwidth)) {
float strwidth;
but->ofs = BLF_width_to_rstrlen(fstyle->uifont_id, but->drawstr,
sizeof(but->drawstr), okwidth, &strwidth);
@@ -1009,7 +1009,7 @@ static float ui_text_clip_middle_ex(uiFontStyle *fstyle, char *str, const float
strwidth = BLF_width(fstyle->uifont_id, str, max_len);
- if (strwidth > okwidth) {
+ if ((okwidth > 0.0f) && (strwidth > okwidth)) {
/* utf8 ellipsis '...', some compilers complain */
const char sep[] = {0xe2, 0x80, 0xa6, 0x0};
const int sep_len = sizeof(sep) - 1;