      */
     func postPhoto() {
 
+        guard let imageToPost = self.imageUserDecidedToPost else {
+            print(NSLocalizedString("Something went wrong, imageUserDecidedToPost shouldn't be nil here", comment: ""))
+            dismissProgressHUDAndReEnableUI()
+            dismissCameraConfirmation()
+            return
+
+        }
+
         dismissProgressHUDAndReEnableUI()
 
         self.confirmationView.endEditing(true) //dismiss keyboard first if shown


        //add caption of image
        if let text = self.confirmationView.titleTextField.text where text != "" {
            imageUserDecidedToPost.caption = text
        } else {
            imageUserDecidedToPost.caption = kEmptyCaptionPlaceHolder
        }

        dispatch_async(dispatch_get_main_queue()) {
            BluemixDataManager.SharedInstance.postNewImage(self.imageUserDecidedToPost)
        }

        //Dismiss Camera Confirmation View when user presses post photo to bring user back to image feed

    var confirmationView: CameraConfirmationView!

    //instance of the image the user decided to post
    var imageUserDecidedToPost: Image?

    //state variables
    var failureGettingUserLocation = false
