From 2ce41e6b27b0dad1d3fec3ed1e2e590b7ad544fc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 9 May 2013 09:40:18 +0530 Subject: [PATCH] Do not fail to load tweaks when the file does not end with a newline --- src/calibre/gui2/preferences/tweaks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/preferences/tweaks.py b/src/calibre/gui2/preferences/tweaks.py index 43370642c5..404648b90a 100644 --- a/src/calibre/gui2/preferences/tweaks.py +++ b/src/calibre/gui2/preferences/tweaks.py @@ -172,7 +172,10 @@ class Tweaks(QAbstractListModel, SearchQueryParser): # {{{ doc.append(line[1:].strip()) doc = '\n'.join(doc) while True: - line = lines[pos] + try: + line = lines[pos] + except IndexError: + break if not line.strip(): break spidx1 = line.find(' ')