Merge pull request #1256 from croneter/fix-keyerror

Fix rare KeyError when using PKC widgets
This commit is contained in:
croneter 2021-01-02 13:15:18 +01:00 committed by GitHub
commit 0982c3bae2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,7 +131,11 @@ def _generate_content(api):
# Item is synched to the Kodi db - let's use that info # Item is synched to the Kodi db - let's use that info
# (will thus e.g. include additional artwork or metadata) # (will thus e.g. include additional artwork or metadata)
item = js.item_details(api.kodi_id, api.kodi_type) 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 = [{ cast = [{
'name': x[0], 'name': x[0],
'thumbnail': x[1], 'thumbnail': x[1],