           response = JSON.parse(responseObject.responseText)
         catch error
           console.error "parsing failed."
-        if response.messages?[0]?.error?
+        if response?.messages?[0]?.error?
           if response.messages[0].error == "tracing.dirtyState"
             $(window).on(
               "beforeunload"

      @push()
      if (notifyOnFailure)
        @trigger("pushFailed", @failedPushCount >= 3 );
      @pushDeferred.reject()
      @pushDeferred = null

    .done (response) =>
      

      
      @version = response.version
      @committedDiffs = []
      if @pushDeferred
        @pushDeferred.resolve()
        @pushDeferred = null