Browse Source

Use strongDelegate to fix error: weak property may be unpredictably set to nil

Myles Abbott 11 years ago
parent
commit
e77fc99138
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Masonry/MASCompositeConstraint.m

+ 2 - 1
Masonry/MASCompositeConstraint.m

@@ -39,7 +39,8 @@
 }
 
 - (MASConstraint *)constraint:(MASConstraint __unused *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute {
-    MASConstraint *newConstraint = [self.delegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute];
+    id<MASConstraintDelegate> strongDelegate = self.delegate;
+    MASConstraint *newConstraint = [strongDelegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute];
     newConstraint.delegate = self;
     [self.childConstraints addObject:newConstraint];
     return newConstraint;