From e3f67f6d7b16ea7dde94a61a44f301ec48425aa2 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 23 Jan 2023 23:36:14 +0100 Subject: [PATCH] Fix legendary version retrieval --- BakkesModInjectorC++/BakkesModInstallation.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/BakkesModInjectorC++/BakkesModInstallation.cpp b/BakkesModInjectorC++/BakkesModInstallation.cpp index 76ad694..df34c31 100644 --- a/BakkesModInjectorC++/BakkesModInstallation.cpp +++ b/BakkesModInjectorC++/BakkesModInstallation.cpp @@ -539,12 +539,18 @@ std::vector BakkesModInstallation::GetEpicVersion() { try { - std::string versionNumber = js["Sugar"]["version"].As().Value(); - LOG_LINE(INFO, "Found Epic version " << versionNumber); - if (!versionNumber.empty()) + if (auto sugar = js.find("Sugar"); sugar != js.end()) { - epicVersions.push_back(versionNumber); + auto& sugarValue = sugar.value(); + std::string versionNumber = sugarValue.value("version", ""); + LOG_LINE(INFO, "Found Epic version " << versionNumber); + + if (!versionNumber.empty()) + { + epicVersions.push_back(versionNumber); + } } + } catch (...) {