From be713e1a80f16fdcaf72448f69d80e2e4490a24c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Jan 2019 18:06:31 +0530 Subject: [PATCH] Fix error when calling goto_sourceline with no tags --- src/calibre/gui2/tweak_book/editor/smarts/html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/editor/smarts/html.py b/src/calibre/gui2/tweak_book/editor/smarts/html.py index d44704f09e..fc75b8c913 100644 --- a/src/calibre/gui2/tweak_book/editor/smarts/html.py +++ b/src/calibre/gui2/tweak_book/editor/smarts/html.py @@ -531,7 +531,7 @@ class Smarts(NullSmarts): ud = block.userData() all_tags = [] if ud is None else [t for t in ud.tags if (t.is_start and not t.closing)] tag_names = [t.name for t in all_tags] - if tag_names[:len(tags)] == tags: + if all_tags and tag_names[:len(tags)] == tags: c.setPosition(block.position() + all_tags[len(tags)-1].offset) found_tag = True else: