From a0f6677964b924588f3e21911af70486e1d8c451 Mon Sep 17 00:00:00 2001 From: SpoinkyNL Date: Thu, 29 Dec 2016 00:43:26 +0100 Subject: [PATCH] Fix for #251 --- .../WindowsProfile/WindowsProfileModel.cs | 18 ++++++++++++++---- Artemis/Artemis/Utilities/Updater.cs | 1 - 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileModel.cs b/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileModel.cs index 22ab35e8d..20d545bec 100644 --- a/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileModel.cs +++ b/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Net; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; @@ -179,11 +180,20 @@ namespace Artemis.Modules.Effects.WindowsProfile var tryCount = 0; while (tryCount <= 10) { - tryCount++; - var connected = _spotify.Connect(); - if (connected) + // Causes WebException if not internet connection is available + try + { + tryCount++; + var connected = _spotify.Connect(); + if (connected) + break; + Thread.Sleep(1000); + } + catch (WebException) + { break; - Thread.Sleep(1000); + } + } _spotifySetupBusy = false; }); diff --git a/Artemis/Artemis/Utilities/Updater.cs b/Artemis/Artemis/Utilities/Updater.cs index 0c856cfd9..115919d14 100644 --- a/Artemis/Artemis/Utilities/Updater.cs +++ b/Artemis/Artemis/Utilities/Updater.cs @@ -46,7 +46,6 @@ namespace Artemis.Utilities { // These exceptions should only really occur when running from VS Logger.Error(e, "Update check failed"); - mgr.Result.Dispose(); } } }