Fix NPE listing local identities with expired session.

useSession() returns null if there is no valid session.