check if currentUser exists (PR #13814)

This is a follow-up fix to aa6daea

GitHub