Added check to prevent object to int casting

Made the RouteVoter more robust in order to fix https://github.com/KnpLabs/KnpMenu/issues/92