Skip to content

Commit f0dfe9a

Browse files
author
Zev Eisenberg
committed
Fix crash when gallery is dismissed while upates are pending.
1 parent ee66d04 commit f0dfe9a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

RIGImageGallery/RIGImageGalleryViewController.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,10 @@ private extension RIGImageGalleryViewController {
310310
for viewController in childViewControllers {
311311
if let index = indexOf(viewController: viewController, imagesArray: oldValue),
312312
let childView = viewController as? RIGSingleImageViewController, index < images.count {
313-
DispatchQueue.main.async { [unowned self] in
314-
childView.viewerItem = self.images[index]
315-
childView.scrollView.baseInsets = self.scrollViewInset
313+
DispatchQueue.main.async { [weak self] in
314+
guard let strongSelf = self else { return }
315+
childView.viewerItem = strongSelf.images[index]
316+
childView.scrollView.baseInsets = strongSelf.scrollViewInset
316317
}
317318
}
318319
}

0 commit comments

Comments
 (0)