michael-lazar / rtv

Browse Reddit from your terminal
MIT License
4.65k stars 278 forks source link

Fix crash in extract_links when self text is blank #622

Closed woorst closed 6 years ago

woorst commented 6 years ago
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/user/builds/rtv/rtv/__main__.py", line 252, in <module>
    sys.exit(main())
  File "/home/user/builds/rtv/rtv/__main__.py", line 231, in main
    page.open_submission(url=url)
  File "/home/user/builds/rtv/rtv/subreddit_page.py", line 186, in open_submission
    page.loop()
  File "/home/user/builds/rtv/rtv/page.py", line 84, in loop
    self.controller.trigger(ch)
  File "/home/user/builds/rtv/rtv/objects.py", line 604, in trigger
    return func(self.instance, *args, **kwargs)
  File "/home/user/builds/rtv/rtv/submission_page.py", line 148, in open_link
    opened_link = self.prompt_and_open_link(data)
  File "/home/user/builds/rtv/rtv/submission_page.py", line 162, in prompt_and_open_link
    extracted_links = self.content.extract_links(data['html'])
  File "/home/user/builds/rtv/rtv/content.py", line 327, in extract_links
    soup = BeautifulSoup(html, 'html.parser')
  File "/usr/lib/python3.7/site-packages/bs4/__init__.py", line 246, in __init__
    elif len(markup) <= 256 and (
TypeError: object of type 'NoneType' has no len()
michael-lazar commented 6 years ago

🙏