Fix null pointer exception Add null check and refactor logic to reduce reduant code. Bug: b/245880827 Test: run atest AuthControllerTest Change-Id: Ib5b4fb985228294dff72da92af678e542fc31f86