     public convenience init(imageInfo: GSImageInfo, transitionInfo: GSTransitionInfo) {
         self.init(imageInfo: imageInfo)
         self.transitionInfo = transitionInfo
-        if let fromView = transitionInfo.fromView, let referenceView = fromView.superview {
+        if
+            let fromView = transitionInfo.fromView,
+            let referenceView = fromView.superview {
+            transitionInfo.convertedRect = referenceView.convert(fromView.frame, to: nil)
+        }
+        if transitionInfo.convertedRect != nil {
             self.transitioningDelegate = self
             self.modalPresentationStyle = .custom
-            transitionInfo.convertedRect = referenceView.convert(fromView.frame, to: nil)
         }
     }
     

                completion: { _ in
                    tempMask.removeFromSuperview()
                    imageViewer.view.removeFromSuperview()
                    self.transitionInfo.fromView!.alpha = 1
                    transitionContext.completeTransition(true)
                }
            )

        containerView.addSubview(tempImage)
        
        if transitionMode == .present {
            transitionInfo.fromView?.alpha = 0
            let imageViewer = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to) as! GSImageViewerController
                imageViewer.view.layoutIfNeeded()
            
