Check for content to highlight
@@ -23,6 +23,7 @@ class PageSearchSerializer(serializers.Serializer):
def get_highlight(self, obj):
highlight = getattr(obj.meta, 'highlight', None)
if highlight:
+ if hasattr(highlight, 'content'):
for num, result in enumerate(highlight.content):
# Change results to turn newlines in highlight into periods
# https://github.com/rtfd/readthedocs.org/issues/5168
