Don't crash when attempting to join a network while the zerotier service isn't running

This commit is contained in:
Grant Limberg 2017-03-08 14:50:37 -08:00
parent 6eb2e3ffa9
commit c8e66a2b45

View file

@ -230,7 +230,8 @@ namespace WinUI
request.Method = "POST";
request.ContentType = "applicaiton/json";
request.Timeout = 10000;
try
{
using (var streamWriter = new StreamWriter(((HttpWebRequest)request).GetRequestStream()))
{
string json = "{\"allowManaged\":" + (allowManaged ? "true" : "false") + "," +
@ -240,6 +241,12 @@ namespace WinUI
streamWriter.Flush();
streamWriter.Close();
}
}
catch (System.Net.WebException)
{
MessageBox.Show("Error Joining Network: Cannot connect to ZeroTier service.");
return;
}
try
{