Fix seo_url so it can work with categories that have a url segment and subcategories that dont

Example:

I have a Bikes category that has the segment url "bikes", under it I added a Mountain Bikes subcategory but I forgot to give it a segment url.
The function will build my url up to the point when it can't find a url segment for my subcategory and I end up with $url = '/bikes' for my Mountain Bikes subcategory.
I added a break and I also reset the $url var so it can return the unprettified url instead "product/category&path=58_151".