From a62b4d38ed133633f244c0e61fc19f12f2764c8b Mon Sep 17 00:00:00 2001 From: David Robles Date: Sun, 18 Dec 2016 21:20:47 -0800 Subject: [PATCH] Assert when attempting to set a nil background / overlay layout element. --- AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm | 1 + AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm | 1 + 2 files changed, 2 insertions(+) diff --git a/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm b/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm index a94c051a6b..51709a3977 100644 --- a/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm @@ -67,6 +67,7 @@ - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize - (void)setBackground:(id)background { + ASDisplayNodeAssertNotNil(background, @"Background cannot be nil"); [super setChild:background atIndex:kBackgroundChildIndex]; } diff --git a/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm b/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm index 8084b22746..3a40123330 100644 --- a/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm @@ -43,6 +43,7 @@ - (instancetype)initWithChild:(id)child overlay:(id)overlay { + ASDisplayNodeAssertNotNil(overlay, @"Overlay cannot be nil"); [super setChild:overlay atIndex:kOverlayChildIndex]; }