title: My swift code performs a segue when even if it shows that an error is occuring in the firebase login
body: <p>This is my code, the first part (Auth.auth.signin) is authenticating with <code>Firebase</code> if the emailId and password is correct. After that, if incorrect, it print incorrect. This part does show up in the console. However, the code performs the <code>segue</code> even though it is not supposed to. Why is this?</p>
  
  <pre><code>@IBAction func loginPressed(_ sender: Any) {
      //TODO: Log in the user
      Auth.auth().signIn(withEmail: emailTextfield.text!, password: passwordTextfield.text!) { (user, error) in
          print(error!)
  
          if(error != nil || user == nil){
              print("incorrect signin")
          }
          else{
              self.performSegue(withIdentifier: "goToChat", sender: self)
              print("Login was good")
  
          }
      }
  }
  </code></pre>