Fixed Cppcheck warning, possible null pointer dereference of tok.