Skip to content

Commit

Permalink
Fix crash when gallery is dismissed while upates are pending.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zev Eisenberg committed Jan 24, 2018
1 parent ee66d04 commit f0dfe9a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions RIGImageGallery/RIGImageGalleryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,10 @@ private extension RIGImageGalleryViewController {
for viewController in childViewControllers {
if let index = indexOf(viewController: viewController, imagesArray: oldValue),
let childView = viewController as? RIGSingleImageViewController, index < images.count {
DispatchQueue.main.async { [unowned self] in
childView.viewerItem = self.images[index]
childView.scrollView.baseInsets = self.scrollViewInset
DispatchQueue.main.async { [weak self] in
guard let strongSelf = self else { return }
childView.viewerItem = strongSelf.images[index]
childView.scrollView.baseInsets = strongSelf.scrollViewInset
}
}
}
Expand Down

0 comments on commit f0dfe9a

Please sign in to comment.