Package: lgogdownloader Version: 3.1-1 Severity: important Tags: patch fixed-upstream
`lgogdownloader --list` crashes if your GOG account has DLC for a game that you don't have, for example if you accidentally added the free DLC for The Witcher 3 like I did. It doesn't seem to be possible to remove items from an account once they have been added, so this is not something that affected users can work around, except by buying the corresponding game. This was fixed upstream shortly after 3.1. S
diffstat for lgogdownloader-3.1 lgogdownloader-3.1 changelog | 8 ++++ patches/Fix-crash-in-Website-getGames.patch | 49 ++++++++++++++++++++++++++++ patches/series | 1 3 files changed, 58 insertions(+) diff -Nru lgogdownloader-3.1/debian/changelog lgogdownloader-3.1/debian/changelog --- lgogdownloader-3.1/debian/changelog 2017-01-16 18:35:28.000000000 +0000 +++ lgogdownloader-3.1/debian/changelog 2017-03-13 22:27:46.000000000 +0000 @@ -1,3 +1,11 @@ +lgogdownloader (3.1-2) UNRELEASED; urgency=medium + + * Team upload + * Backport patch from 3.2 fixing the ability to list games if a game + has {'updates': null} + + -- Simon McVittie <s...@debian.org> Mon, 13 Mar 2017 22:27:46 +0000 + lgogdownloader (3.1-1) unstable; urgency=medium * New upstream release. diff -Nru lgogdownloader-3.1/debian/patches/Fix-crash-in-Website-getGames.patch lgogdownloader-3.1/debian/patches/Fix-crash-in-Website-getGames.patch --- lgogdownloader-3.1/debian/patches/Fix-crash-in-Website-getGames.patch 1970-01-01 01:00:00.000000000 +0100 +++ lgogdownloader-3.1/debian/patches/Fix-crash-in-Website-getGames.patch 2017-03-13 22:27:46.000000000 +0000 @@ -0,0 +1,49 @@ +From: Sude <lgogdownloa...@gmail.com> +Date: Fri, 20 Jan 2017 00:15:50 +0200 +Subject: Fix crash in Website::getGames + +JSON value for updates can be null in some cases. For example when user owns a dlc but not the base game. +This caused a crash due to std::stoi throwing std::invalid_argument exception + +Origin: upstream, 3.2, commit:22f47de4fcd8cd7ecc2a89fbb25f94efb1b3f743 +--- + src/website.cpp | 26 +++++++++++++++++++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +diff --git a/src/website.cpp b/src/website.cpp +index 0803432..8ca4c8c 100644 +--- a/src/website.cpp ++++ b/src/website.cpp +@@ -163,7 +163,31 @@ std::vector<gameItem> Website::getGames() + gameItem game; + game.name = product["slug"].asString(); + game.id = product["id"].isInt() ? std::to_string(product["id"].asInt()) : product["id"].asString(); +- game.updates = product["updates"].isInt() ? product["updates"].asInt() : std::stoi(product["updates"].asString()); ++ ++ if (product.isMember("updates")) ++ { ++ if (product["updates"].isNull()) ++ { ++ /* In some cases the value can be null. ++ * For example when user owns a dlc but not the base game ++ * https://github.com/Sude-/lgogdownloader/issues/101 ++ * Assume that there are no updates in this case */ ++ game.updates = 0; ++ } ++ else if (product["updates"].isInt()) ++ game.updates = product["updates"].asInt(); ++ else ++ { ++ try ++ { ++ game.updates = std::stoi(product["updates"].asString()); ++ } ++ catch (std::invalid_argument& e) ++ { ++ game.updates = 0; // Assume no updates ++ } ++ } ++ } + + unsigned int platform = 0; + if (product["worksOn"]["Windows"].asBool()) diff -Nru lgogdownloader-3.1/debian/patches/series lgogdownloader-3.1/debian/patches/series --- lgogdownloader-3.1/debian/patches/series 2016-05-09 22:28:40.000000000 +0100 +++ lgogdownloader-3.1/debian/patches/series 2017-03-13 22:27:46.000000000 +0000 @@ -1 +1,2 @@ +Fix-crash-in-Website-getGames.patch manpage-whatis.patch