Added error handling for a null username/password.