2.5: Image Editor
[blender-staging.git] / source / blender / editors / sculpt_paint / paint_image.c
index 1effd8fd3778373651874bd0f62f4f8fd569d4a6..a163ef5f8e29fe034d8e1340d683df82771e1e7f 100644 (file)
@@ -4517,6 +4517,9 @@ static int paint_init(bContext *C, wmOperator *op)
        pop->ps.ar= CTX_wm_region(C);
 
        /* intialize brush */
+       if(!settings->imapaint.brush)
+               return 0;
+
        pop->s.brush = settings->imapaint.brush;
        pop->s.tool = settings->imapaint.tool;
        if(pop->mode == PAINT_MODE_3D && (pop->s.tool == PAINT_TOOL_CLONE))
@@ -4536,6 +4539,10 @@ static int paint_init(bContext *C, wmOperator *op)
                if (!pop->s.ob || !(pop->s.ob->lay & pop->ps.v3d->lay)) return 0;
                pop->s.me = get_mesh(pop->s.ob);
                if (!pop->s.me) return 0;
+
+               /* Dont allow brush size below 2 */
+               if (pop->ps.brush && pop->ps.brush->size<=1)
+                       pop->ps.brush->size = 2;
        }
        else {
                pop->s.image = pop->s.sima->image;
@@ -4548,10 +4555,6 @@ static int paint_init(bContext *C, wmOperator *op)
 
                        return 0;
                }
-               
-               /* Dont allow brush size below 2 */
-               if (pop->ps.brush->size<=1)
-                       pop->ps.brush->size = 2;
        }
        
        /* note, if we have no UVs on the derived mesh, then we must return here */