Fix: Error when library other than collection selected

pull/30/head
Juraj Nyíri 3 years ago
parent dd5a9c0e7a
commit e3dab9e5c6

@ -21146,7 +21146,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
collectionToGet = collection; collectionToGet = collection;
} }
}); });
this.data[collectionToGet.title] = await this.plex.getCollectionData(collectionToGet.key); if (!lodash.isNil(collectionToGet.key)) {
this.data[collectionToGet.title] = await this.plex.getCollectionData(collectionToGet.key);
}
if (this.data[this.config.libraryName] === undefined) { if (this.data[this.config.libraryName] === undefined) {
this.error = `Library name ${this.config.libraryName} does not exist.`; this.error = `Library name ${this.config.libraryName} does not exist.`;
} }

@ -433,7 +433,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
collectionToGet = collection; collectionToGet = collection;
} }
}); });
this.data[collectionToGet.title] = await this.plex.getCollectionData(collectionToGet.key); if (!_.isNil(collectionToGet.key)) {
this.data[collectionToGet.title] = await this.plex.getCollectionData(collectionToGet.key);
}
if (this.data[this.config.libraryName] === undefined) { if (this.data[this.config.libraryName] === undefined) {
this.error = `Library name ${this.config.libraryName} does not exist.`; this.error = `Library name ${this.config.libraryName} does not exist.`;

Loading…
Cancel
Save