diff --git a/Source/Tools/FEXRootFSFetcher/Main.cpp b/Source/Tools/FEXRootFSFetcher/Main.cpp index 022b70850c..7ccbb458bf 100644 --- a/Source/Tools/FEXRootFSFetcher/Main.cpp +++ b/Source/Tools/FEXRootFSFetcher/Main.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -514,10 +515,14 @@ namespace WebFileFetcher { return &*alloc->json_objects->emplace(alloc->json_objects->end()); } - std::vector GetRootFSLinks() { + std::optional> GetRootFSLinks() { // Decode the filetargets std::string Data = DownloadToString(DownloadURL); + if (Data.empty()) { + return std::nullopt; + } + JsonAllocator Pool { .PoolObject = { .init = PoolInit, @@ -1121,7 +1126,14 @@ int main(int argc, char **argv, char **const envp) { } if (AskForConfirmation(Question)) { - auto Targets = WebFileFetcher::GetRootFSLinks(); + auto TargetReturn = WebFileFetcher::GetRootFSLinks(); + if (!TargetReturn.has_value()) { + ExecWithInfo("Couldn't download rootfs list from the server. Try again in a minute or report on the fex-emu issue tracker."); + return -1; + } + + auto Targets = TargetReturn.value(); + if (Targets.empty()) { ExecWithInfo("Couldn't parse rootfs definition URL."); return -1;