mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Fix regression that caused an error when trying to edit files with no defined syntax, such as plain .txt files. Fixes #1318139 [Editor: Synatax-Highlighter error](https://bugs.launchpad.net/calibre/+bug/1318139)
This commit is contained in:
parent
359e410920
commit
29c8943ebd
@ -107,7 +107,7 @@ class SyntaxHighlighter(object):
|
||||
@pyqtSlot(int, int, int)
|
||||
def reformat_blocks(self, position, removed, added):
|
||||
doc = self.doc
|
||||
if doc is None:
|
||||
if doc is None or not hasattr(self, 'state_map'):
|
||||
return
|
||||
last_block = doc.findBlock(position + added + (1 if removed > 0 else 0))
|
||||
if not last_block.isValid():
|
||||
|
Loading…
x
Reference in New Issue
Block a user