diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-03 12:39:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-03 12:39:46 +0300 |
commit | 3289eff6d9a36b6640606a4e113573bdf88f76c1 (patch) | |
tree | f8aa632e041f2b640f726f7007c0693aae7c77f6 /source/blender/editors/interface | |
parent | 53596fc6b8f47d9dec633b1ea5ae56a893d0cf3f (diff) |
bugfix [#20944] bad use of wm.invoke_popup(self) is crashing Blender
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 40efabda061..cd9ebe6996f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -372,12 +372,16 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_ /* and we adjust the position to fit within window */ width= block->maxx - block->minx; height= block->maxy - block->miny; + + /* avoid divide by zero below, caused by calling with no UI, but better not crash */ + oldwidth= oldwidth > 0 ? oldwidth : MAX2(1, width); + oldheight= oldheight > 0 ? oldheight : MAX2(1, height); /* offset block based on mouse position, user offset is scaled along in case we resized the block in ui_text_bounds_block */ startx= window->eventstate->x + block->minx + (block->mx*width)/oldwidth; starty= window->eventstate->y + block->miny + (block->my*height)/oldheight; - + if(startx<10) startx= 10; if(starty<10) |