From 328000d9f7d163849a5d08e5974f52930dbd8394 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 16 Nov 2014 22:30:21 +0530 Subject: [PATCH] ... --- src/calibre/gui2/tweak_book/editor/smart/html.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/editor/smart/html.py b/src/calibre/gui2/tweak_book/editor/smart/html.py index 838d076e9a..4e3b5b62d9 100644 --- a/src/calibre/gui2/tweak_book/editor/smart/html.py +++ b/src/calibre/gui2/tweak_book/editor/smart/html.py @@ -451,8 +451,10 @@ class HTMLSmarts(NullSmarts): ''' Move the cursor to the tag identified by sourceline and tags (a list of tags names on the specified line). If attribute is specified the cursor will be placed at the start of the attribute value. ''' - block = editor.document().findBlockByNumber(sourceline - 1) # blockNumber() is zero based found_tag = False + if sourceline is None: + return found_tag + block = editor.document().findBlockByNumber(sourceline - 1) # blockNumber() is zero based if not block.isValid(): return found_tag c = editor.textCursor()