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.

And with the words of Cato the Elder: Ceterum censeo Joomlacode esse delendam (I believe that Joomlacode has to be destroyed. ;-) )