From 089294681e96fc7d9d3d83fd7c336ae88d58bcc7 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 2 Jan 2021 11:54:53 +0100 Subject: [PATCH] Fix rare KeyError when using PKC widgets --- resources/lib/widgets.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/lib/widgets.py b/resources/lib/widgets.py index 80805f00..b9c779a2 100644 --- a/resources/lib/widgets.py +++ b/resources/lib/widgets.py @@ -131,7 +131,11 @@ def _generate_content(api): # Item is synched to the Kodi db - let's use that info # (will thus e.g. include additional artwork or metadata) item = js.item_details(api.kodi_id, api.kodi_type) - else: + + # In rare cases, Kodi's JSON reply does not provide 'title' plus potentially + # other fields - let's use the PMS answer to be safe + # See https://github.com/croneter/PlexKodiConnect/issues/1129 + if not api.kodi_id or 'title' not in item: cast = [{ 'name': x[0], 'thumbnail': x[1],