Verbessere die Statusverarbeitung in der Methode spyIn, indem die Zuweisung des Status aus dem JSON-Objekt optimiert wird. Verwende nun die get-Methode für eine klarere und sicherere Zuweisung.

This commit is contained in:
Torsten Schulz (local)
2025-09-01 07:57:37 +02:00
committed by Torsten (PC)
parent 8ba4566d23
commit 8b9ff9793c

View File

@@ -110,8 +110,11 @@ nlohmann::json UndergroundWorker::spyIn(int performerId,int victimId,const json&
}
std::string status = "pending";
if(result.is_object()){
if(auto s = result.find("status"); s!=result.end() && s->is_string()) status = *s;
else status = "done";
if(auto s = result.find("status"); s!=result.end() && s->is_string()) {
status = s->get<std::string>();
} else {
status = "done";
}
}
activities.push_back({
{"id", std::stoi(r.at("id"))},