From 3ab933c9ab223b07bb9c6901f1676f8ddf8ea599 Mon Sep 17 00:00:00 2001 From: Ed Simmons <70568004+Ed-Simmons@users.noreply.github.com> Date: Tue, 6 Jul 2021 14:51:18 +0200 Subject: [PATCH] Fix Fatal Exception: NSInternalInconsistencyException negative sizes are not supported in the flow layout This fix has been applied to another fork of QBImagePicker: https://github.com/smartmobilefactory/QBImagePicker/commit/13ce139351159dafecbde65a6127eb1e0628e805#diff-6867ab519767f28278432bf69b8c7a47807807610803bc1fd0568e390c02c5ec --- QBImagePicker/QBAssetsViewController.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/QBImagePicker/QBAssetsViewController.m b/QBImagePicker/QBAssetsViewController.m index fec84b5c..09a792e5 100644 --- a/QBImagePicker/QBAssetsViewController.m +++ b/QBImagePicker/QBAssetsViewController.m @@ -666,6 +666,12 @@ - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollection CGFloat width = (CGRectGetWidth(self.view.frame) - 2.0 * (numberOfColumns - 1)) / numberOfColumns; + // Fatal Exception: NSInternalInconsistencyException negative sizes are not supported in the flow layout + // The width and height of the specified item. Both values must be greater than 0. + if (width <= 0) { + width = 1.0f; + } + return CGSizeMake(width, width); }