From 21efb90b4c6b0e0e446b73e3fad3f13336cc0d8a Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Fri, 8 Feb 2013 11:46:08 +0000 Subject: [PATCH] Refs #1700. Fixed: setItemPrototype crash. Setting the item prototype without first adding the collection view to a view would cause a crash, as would reloadContent. This fix makes sure the collection view doesn't try to tile itself unless it has a frame. --- AppKit/CPCollectionView.j | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index 6b28e452a..ef0b2f811 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -492,6 +492,10 @@ var HORIZONTAL_MARGIN = 2; oldItemSize = _itemSize, storedFrameSize = _storedFrameSize; + // No need to tile if we are not yet placed in the view hierarchy. + if (!frameSize) + return; + [self _updateMinMaxItemSizeIfNeeded]; [self _computeGridWithSize:frameSize count:AT_REF(count)];