[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45920] trunk/blender/source/blender/ editors/sculpt_paint/paint_ops.c: crash fix for brush select when no object is active

Campbell Barton ideasman42 at gmail.com
Tue Apr 24 14:27:38 CEST 2012


Revision: 45920
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45920
Author:   campbellbarton
Date:     2012-04-24 12:27:38 +0000 (Tue, 24 Apr 2012)
Log Message:
-----------
crash fix for brush select when no object is active

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2012-04-24 12:07:26 UTC (rev 45919)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2012-04-24 12:27:38 UTC (rev 45920)
@@ -254,12 +254,18 @@
 	size_t tool_offset;
 
 	if (paint_mode == OB_MODE_ACTIVE) {
-		/* select current paint mode */
-		paint_mode = CTX_data_active_object(C)->mode &
-		             (OB_MODE_SCULPT |
-		              OB_MODE_VERTEX_PAINT |
-		              OB_MODE_WEIGHT_PAINT |
-		              OB_MODE_TEXTURE_PAINT);
+		Object *ob = CTX_data_active_object(C);
+		if (ob) {
+			/* select current paint mode */
+			paint_mode = ob->mode &
+			             (OB_MODE_SCULPT |
+			              OB_MODE_VERTEX_PAINT |
+			              OB_MODE_WEIGHT_PAINT |
+			              OB_MODE_TEXTURE_PAINT);
+		}
+		else {
+			return OPERATOR_CANCELLED;
+		}
 	}
 
 	switch (paint_mode) {




More information about the Bf-blender-cvs mailing list