Fix project find loop by stopping on a project.

On my jenkins / gitlab settings (latest versions), there seem to be a problem finding the project out of its name.
So I've debugged and found adding this test avoid the problem.
I'm not sure but I'm submitting this patch if it's a correct way to do.