Add check for empty galleries (triggered by haystack indexing search)