diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-07-27 17:49:55 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-07-27 17:49:55 +0400 |
commit | f230a94d498eee9f388a4d0751105a0944927850 (patch) | |
tree | f51960376a497cc99d84a86c2a9fca6a7ea7df80 /source | |
parent | abeeebd08907838f87ae618c2d2c093ee5c206a2 (diff) |
Fix crash in drawing socket names when zooming out a lot
--
svn merge -r49291:49292 ^/branches/soc-2011-tomato
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 6aec69ca61a..ad3e1954e68 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -217,16 +217,20 @@ static void node_draw_output_default(const bContext *C, uiBlock *block, float slen; int ofs = 0; const char *ui_name = IFACE_(name); + int len = strlen(ui_name); UI_ThemeColor(TH_TEXT); slen = (UI_GetStringWidth(ui_name) + NODE_MARGIN_X) * snode->aspect_sqrt; - while (slen > node->width) { + while (slen > node->width && ofs < len) { ofs++; slen = (UI_GetStringWidth(ui_name + ofs) + NODE_MARGIN_X) * snode->aspect_sqrt; } - uiDefBut(block, LABEL, 0, ui_name + ofs, - (int)(sock->locx - slen), (int)(sock->locy - 9.0f), - (short)(node->width - NODE_DY), (short)NODE_DY, - NULL, 0, 0, 0, 0, ""); + + if (ofs < len) { + uiDefBut(block, LABEL, 0, ui_name + ofs, + (int)(sock->locx - slen), (int)(sock->locy - 9.0f), + (short)(node->width - NODE_DY), (short)NODE_DY, + NULL, 0, 0, 0, 0, ""); + } (void)snode; } |