Fix the crash in completion entry by fixing the unknown token check

Fixes #1069