Issue KEYCLOAK-519

Pull request to fix KEYCLOAK-519. I flipped comparison operands to avoid NPE