         })
 
         let startingViewFinalTransform = 1.0 / endingViewInitialTransform
-        let translatedEndingViewFinalCenter = PhotoTransitionAnimator.centerPointForView(endingView, translatedToContainerView: containerView)
-
-        UIView.animateWithDuration(transitionDuration(transitionContext), delay: 0, usingSpringWithDamping: zoomingAnimationSpringDamping, initialSpringVelocity: 0, options: [.AllowAnimatedContent, .BeginFromCurrentState], animations: { 
-            endingViewForAnimation.transform = finalEndingViewTransform
-            endingViewForAnimation.center = translatedEndingViewFinalCenter
+
+        var translatedEndingViewFinalCenter: CGPoint?
+        if let endingView = endingView {
+            translatedEndingViewFinalCenter = PhotoTransitionAnimator.centerPointForView(endingView, translatedToContainerView: containerView)
+        }
+
+        UIView.animateWithDuration(transitionDuration(transitionContext), delay: 0, usingSpringWithDamping: zoomingAnimationSpringDamping, initialSpringVelocity: 0, options: [.AllowAnimatedContent, .BeginFromCurrentState], animations: {
+
+            if let finalEndingViewTransform = finalEndingViewTransform {
+                endingViewForAnimation.transform = finalEndingViewTransform
+            }
+
+            if let translatedEndingViewFinalCenter = translatedEndingViewFinalCenter {
+                endingViewForAnimation.center = translatedEndingViewFinalCenter
+            }
             
             startingViewForAnimation.transform = CGAffineTransformScale(startingViewForAnimation.transform, startingViewFinalTransform, startingViewFinalTransform)
-            startingViewForAnimation.center = translatedEndingViewFinalCenter
+
+            if let translatedEndingViewFinalCenter = translatedEndingViewFinalCenter {
+                startingViewForAnimation.center = translatedEndingViewFinalCenter
+            }
 
         }, completion: { [unowned self] finished in
             endingViewForAnimation.removeFromSuperview()
-            endingView.alpha = 1
-            startingView.alpha = 1
+            self.endingView?.alpha = 1
+            self.startingView?.alpha = 1
 
             self.completeTransitionWithTransitionContext(transitionContext)
         })


        let containerView = transitionContext.containerView()!

        guard let startingView = startingView else {
            return
        }
        guard let endingView = endingView else {
            return
        }

        let startingViewForAnimation = self.startingViewForAnimation ?? PhotoTransitionAnimator.newAnimationViewFromView(startingView)
        let endingViewForAnimation = self.startingViewForAnimation ?? PhotoTransitionAnimator.newAnimationViewFromView(endingView)

        let finalEndingViewTransform = endingView.transform

        let endingViewInitialTransform = startingViewForAnimation.frame.height / endingViewForAnimation.frame.height

        let translatedStartingViewCenter = PhotoTransitionAnimator.centerPointForView(startingView, translatedToContainerView: containerView)

        startingViewForAnimation.center = translatedStartingViewCenter

        endingViewForAnimation.transform = CGAffineTransformScale(endingViewForAnimation.transform, endingViewInitialTransform, endingViewInitialTransform)
        endingViewForAnimation.center = translatedStartingViewCenter
        endingViewForAnimation.alpha = 0

        containerView.addSubview(startingViewForAnimation)
        containerView.addSubview(endingViewForAnimation)

        startingView.alpha = 0
        endingView.alpha = 0

        let fadeInDuration = transitionDuration(transitionContext) * animationDurationEndingViewFadeInRatio
        let fadeOutDuration = transitionDuration(transitionContext) * animationDurationStartingViewFadeOutRatio

            viewToFade?.alpha = endingAlpha

        }, completion: { [unowned self] finished in
            if !self.shouldPerformZoomingAnimation {
                self.completeTransitionWithTransitionContext(transitionContext)
            }
        })
