fix download code, error checking

This commit is contained in:
Lion Kortlepel
2024-10-04 23:12:23 +02:00
parent 5c77e60f29
commit 85908e42d5
2 changed files with 6 additions and 24 deletions

View File

@@ -58,7 +58,7 @@ std::string Login(const std::string& fields) {
try {
std::string Buffer = HTTP::Post("https://auth.beammp.com/userlogin", fields);
if (Buffer == "-1") {
if (Buffer.empty()) {
return GetFail("Failed to communicate with the auth system!");
}
@@ -119,7 +119,7 @@ void CheckLocalKey() {
nlohmann::json d = nlohmann::json::parse(Buffer, nullptr, false);
if (Buffer == "-1" || Buffer.at(0) != '{' || d.is_discarded()) {
if (Buffer.empty() || Buffer.at(0) != '{' || d.is_discarded()) {
error(Buffer);
info("Invalid answer from authentication servers.");
UpdateKey(nullptr);