url_preview: Fix crash when description has no content.

There's several things we'll want to cleanup with this feature, but
for now we're content to just make this not crash.
This commit is contained in:
Tim Abbott 2018-05-17 12:40:43 -07:00
parent d5e7b9599d
commit 3006b3f52f
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ class GenericParser(BaseParser):
def _get_description(self) -> Optional[str]:
soup = self._soup
meta_description = soup.find('meta', attrs={'name': 'description'})
if (meta_description and meta_description['content'] != ''):
if (meta_description and meta_description.get('content', '') != ''):
return meta_description['content']
first_h1 = soup.find('h1')
if first_h1: