check identity != NULL before dereferencing