Fix update prompt showing up when no update is available if logged out and using the beta channel

This commit is contained in:
jacob1
2024-03-17 18:16:53 -04:00
parent eef8943a3c
commit 8452d96bf6

View File

@@ -52,6 +52,10 @@ namespace http
return; return;
} }
auto &info = versions[key]; auto &info = versions[key];
if (info.isNull())
{
return;
}
auto getOr = [&info](ByteString key, int defaultValue) -> int { auto getOr = [&info](ByteString key, int defaultValue) -> int {
if (!info.isMember(key)) if (!info.isMember(key))
{ {
@@ -59,7 +63,7 @@ namespace http
} }
return info[key].asInt(); return info[key].asInt();
}; };
auto build = getOr(key == "Snapshot" ? "Snapshot" : "Build", -1); auto build = getOr(key == "Snapshot" ? "Snapshot" : "Build", 0);
if (!updateAvailableFunc(build)) if (!updateAvailableFunc(build))
{ {
return; return;
@@ -68,8 +72,8 @@ namespace http
channel, channel,
ByteString::Build(SCHEME, alternate ? UPDATESERVER : SERVER, info["File"].asString()), ByteString::Build(SCHEME, alternate ? UPDATESERVER : SERVER, info["File"].asString()),
ByteString(info["Changelog"].asString()).FromUtf8(), ByteString(info["Changelog"].asString()).FromUtf8(),
getOr("Major", -1), getOr("Major", 0),
getOr("Minor", -1), getOr("Minor", 0),
build, build,
}; };
}; };