From 48b0ef0e69795baa8f97d56a27d579a9fc452b61 Mon Sep 17 00:00:00 2001 From: Saad BENBOUZID Date: Sun, 11 Sep 2022 21:59:28 -0400 Subject: [PATCH] Fix issue #189 : "year" and "starRating" are optional in xmltv contract --- src/GuideManager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GuideManager.cpp b/src/GuideManager.cpp index e5fd6416..6ee8c69f 100644 --- a/src/GuideManager.cpp +++ b/src/GuideManager.cpp @@ -183,12 +183,14 @@ int GuideManager::AddEvents( e.cast = p->extra.cast; e.directors = p->extra.directors; e.writers = p->extra.writers; - e.year = std::stoi(p->date.substr(0, 4)); + if (!p->date.empty()) + e.year = std::stoi(p->date.substr(0, 4)); e.iconPath = p->icon; e.genreType = p->extra.genreType; e.genreDescription = p->extra.genreDescription; e.firstAired = p->previouslyShown; - e.starRating = std::stoi(p->starRating.substr(0, 1)); + if (!p->starRating.empty()) + e.starRating = std::stoi(p->starRating.substr(0, 1)); e.episodeNumber = p->episodeNumber; e.episodeName = p->subTitle;