add null check for CurrentPrincipal

fixes #2030