Skip to content

Commit

Permalink
Fixed an issue that would crash the tool for everyone...
Browse files Browse the repository at this point in the history
  • Loading branch information
FelisDiligens committed Oct 25, 2022
1 parent 13d50a7 commit 28dbcc3
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions Fo76ini/Forms/FormMain/Views/UserControlHome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,28 @@ private String ScrapeServerStatus()

if (request.Success && request.StatusCode == HttpStatusCode.OK)
{
// Scrap for Fallout 76 Status:
JObject responseJSON = request.GetJObject();
JArray components = (JArray)responseJSON["components"];
foreach (JObject component in components)
try
{
string id = component["id"].ToObject<string>();
string name = component["name"].ToObject<string>();
string status = component["status"].ToObject<string>();

if (id == "m39k311rzvkg" || name == "Fallout 76")
f76Status = status;
// Scrap for Fallout 76 Status:
JObject responseJSON = request.GetJObject();
JArray components = (JArray)responseJSON["components"];
foreach (JObject component in components)
{
string id = component["id"].ToObject<string>();
string name = component["name"].ToObject<string>();
string status = component["status"].ToObject<string>();

if (id == "m39k311rzvkg" || name == "Fallout 76")
f76Status = status;
}
}
catch (Newtonsoft.Json.JsonReaderException)
{
f76Status = $"Error: Couldn't parse server response";
}
catch (Exception e)
{
f76Status = $"Unknown error: {e.Message}";
}
}
else
Expand Down

0 comments on commit 28dbcc3

Please sign in to comment.