Fixes primary category offset error

Prevents PHP errors in front end templates when trying to return a
primary category if no categories are set for the entry in question.