Fixing broken URL creation when categories are trashed or unpublished

When a category is not published or when it is trashed, the URLs are not created and instead a fatal error is thrown. This is an issue with indexing in smart search.