Check for categories before attempting to loop.