First of all, both of you are of type String, so if there is no combination of numbers and letters, there will be a null pointer. I don't see the implementation of dao from your code. It's hard to say. It may be that the value of username is not found in the database, so it is empty. Your judgment is not very rigorous. If you don’t fill in the password, a null pointer exception will occur
Is it empty because the user was not found?
The error message contains the number of lines of code and a null pointer
First of all, both of you are of type String, so if there is no combination of numbers and letters, there will be a null pointer. I don't see the implementation of dao from your code. It's hard to say. It may be that the value of username is not found in the database, so it is empty. Your judgment is not very rigorous. If you don’t fill in the password, a null pointer exception will occur
Try password!=null