From fa0d8db045e3c548a230e191ae2c0910b20ae782 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Wed, 2 Feb 2011 18:53:19 +0000 Subject: [PATCH] Correct implementation of case in _set_authors --- src/calibre/library/database2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 88f2ce32de..ce2d24c045 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1642,8 +1642,11 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): a = a.strip().replace(',', '|') if not isinstance(a, unicode): a = a.decode(preferred_encoding, 'replace') - author_id, name = \ - self.conn.get('SELECT id, name from authors WHERE name=?', (a,))[0] + aus = self.conn.get('SELECT id, name from authors WHERE name=?', (a,)) + if aus: + author_id, name = aus[0] + else: + author_id, name = (None, None) if author_id: aid = author_id # Handle change of case