Fixed: [CPBox setContentView:nil] crash.

This is allowed in Cocoa so should not crash Cappuccino either.
This commit is contained in:
Alexander Ljungberg committed 2013-02-22 14:42:36 +00:00
1 parent 7ab84ca607
commit 09b5eef617
1 file changed
+8 -1
+8 -1
View File
@@ -287,7 +287,14 @@ CPBelowBottom = 6;
[aView setFrame:CGRectInset([self bounds], contentMargin.width + borderWidth, contentMargin.height + borderWidth)];
[aView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[self replaceSubview:_contentView with:aView];
// A nil contentView is allowed (tested in Cocoa 2013-02-22).
if (!aView)
[_contentView removeFromSuperview];
else if (_contentView)
[self replaceSubview:_contentView with:aView];
else
[self addSubview:aView];
_contentView = aView;
}