From d069fc7c480aa5b0364065b036f82004941e15c5 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Tue, 11 Oct 2016 18:28:07 +0200 Subject: [PATCH] Fix IndexError on deleting items --- resources/lib/librarysync.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index fa79e5cb..83e88146 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -1491,10 +1491,13 @@ class LibrarySync(Thread): "processing queue" for later """ for item in data: - typus = item.get('type') - state = item.get('state') + typus = int(item.get('type', 0)) + state = int(item.get('state', 0)) if state == 9 or typus in (1, 4, 10): - itemId = item.get('itemID') + itemId = str(item.get('itemID', '0')) + if itemId == '0': + log.warn('Received malformed PMS message: %s' % item) + continue # Have we already added this element? for existingItem in self.itemsToProcess: if existingItem['ratingKey'] == itemId: