SpaceDetailPresenter: Avoid crash on iPad when the source view is nil.

This commit is contained in:
SBiOSoftWhare 2021-10-19 14:38:57 +02:00
parent c62470bc3c
commit eb2daaf684

View file

@ -98,7 +98,8 @@ class SpaceDetailPresenter: NSObject {
} else {
// Configure source view when view controller is presented with a popover
viewController.modalPresentationStyle = .popover
if let sourceView = self.sourceView, let popoverPresentationController = viewController.popoverPresentationController {
if let popoverPresentationController = viewController.popoverPresentationController, let sourceView = sourceView ?? viewController.view {
popoverPresentationController.sourceView = sourceView
popoverPresentationController.sourceRect = sourceView.bounds
}