Skip to content

Commit 06cd8c6

Browse files
author
Jari Kalinainen
committed
fix possible crash
1 parent a489ecf commit 06cd8c6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

UIImageCropper.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'UIImageCropper'
11-
s.version = '1.3.1'
11+
s.version = '1.3.2'
1212
s.summary = 'Simple Image cropper for UIImage and UIImagePickerController with customisable aspect ratio.'
1313

1414
# This description is used to generate tags and improve search results.

UIImageCropper/UIImageCropper.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ public class UIImageCropper: UIViewController, UIImagePickerControllerDelegate,
297297
layoutDone = false
298298

299299
self.image = image.fixOrientation()
300-
picker.present(self, animated: true, completion: nil)
300+
if var topController = UIApplication.shared.keyWindow?.rootViewController {
301+
while let presentedViewController = topController.presentedViewController {
302+
topController = presentedViewController
303+
}
304+
topController.present(self, animated: true, completion: nil)
305+
}
301306
}
302307
}

0 commit comments

Comments
 (0)