From 0d810cc05dc88ad57cb0a82ccbfce9ddd3b4bebf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 4 Jun 2016 15:05:02 +0530 Subject: [PATCH] ... --- 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 edabbb1ef1..3bc3f4ab18 100644 --- a/src/calibre/gui2/tweak_book/editor/smarts/html.py +++ b/src/calibre/gui2/tweak_book/editor/smarts/html.py @@ -116,7 +116,7 @@ def find_closest_containing_tag(block, offset, max_tags=sys.maxint): def find_tag_definition(block, offset): ''' Return the definition, if any that (block, offset) is inside. ''' block, boundary = next_tag_boundary(block, offset, forward=False) - if not boundary.is_start: + if not boundary or not boundary.is_start: return None, False tag_start = boundary closing = tag_start.closing