fix view link crashing with empty files

This commit is contained in:
Ploum 2024-02-11 12:14:52 +01:00
parent 36c9709bc4
commit 9bec3b48dd
2 changed files with 6 additions and 2 deletions

View File

@ -16,6 +16,7 @@
- offpunk: support for "preformatted" theming (bug #38)
- opnk/netcache: added "--cache-validity" command-line argument (bug #37)
- ansicat: consider files as XML, not SVG, if they dont have .svg extension
- offpunk: fix "view link" crashing with link to empty files
## 2.1 - December 15th 2023
- freshly updated gemtext/rss links are highlighted ("new_link" theme option)

View File

@ -991,8 +991,11 @@ Use "view XX" where XX is a number to view information about link XX.
if netcache.is_cache_valid(link_url):
last_modified = netcache.cache_last_modified(link_url)
link_renderer = self.get_renderer(link_url)
link_title = link_renderer.get_page_title()
print(link_title)
if link_renderer:
link_title = link_renderer.get_page_title()
print(link_title)
else:
print("Empty cached version")
print("Last cached on %s"%time.ctime(last_modified))
else:
print("No cached version for this link")