Bugfix #19887: Blender crash when resizing nodes in node editor
authorJoshua Leung <aligorith@gmail.com>
Sun, 15 Nov 2009 11:32:29 +0000 (11:32 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 15 Nov 2009 11:32:29 +0000 (11:32 +0000)
This commit fixes the crash, but there are currently some issues with getting the active node in general with the Nodes Editor.

source/blender/editors/space_node/node_edit.c

index 70c47a6..b76f5d7 100644 (file)
@@ -1169,13 +1169,15 @@ static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event)
                        UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, 
                                                                         &mx, &my);
                        
-                       if(node->flag & NODE_HIDDEN) {
-                               node->miniwidth= nsw->oldwidth + mx - nsw->mxstart;
-                               CLAMP(node->miniwidth, 0.0f, 100.0f);
-                       }
-                       else {
-                               node->width= nsw->oldwidth + mx - nsw->mxstart;
-                               CLAMP(node->width, node->typeinfo->minwidth, node->typeinfo->maxwidth);
+                       if (node) {
+                               if(node->flag & NODE_HIDDEN) {
+                                       node->miniwidth= nsw->oldwidth + mx - nsw->mxstart;
+                                       CLAMP(node->miniwidth, 0.0f, 100.0f);
+                               }
+                               else {
+                                       node->width= nsw->oldwidth + mx - nsw->mxstart;
+                                       CLAMP(node->width, node->typeinfo->minwidth, node->typeinfo->maxwidth);
+                               }
                        }
                                
                        ED_region_tag_redraw(ar);