From dac7c664d98547357d32737207c48b98572f0852 Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Thu, 2 Apr 2020 20:08:16 +0300 Subject: [PATCH] [GUI] Ensure update has been prepared before attempting to install it --- DiscordChatExporter.Gui/Services/UpdateService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DiscordChatExporter.Gui/Services/UpdateService.cs b/DiscordChatExporter.Gui/Services/UpdateService.cs index 881e7a1..12e72b3 100644 --- a/DiscordChatExporter.Gui/Services/UpdateService.cs +++ b/DiscordChatExporter.Gui/Services/UpdateService.cs @@ -16,6 +16,7 @@ namespace DiscordChatExporter.Gui.Services private readonly SettingsService _settingsService; private Version? _updateVersion; + private bool _updatePrepared; private bool _updaterLaunched; public UpdateService(SettingsService settingsService) @@ -40,6 +41,7 @@ namespace DiscordChatExporter.Gui.Services try { await _updateManager.PrepareUpdateAsync(_updateVersion = version); + _updatePrepared = true; } catch (UpdaterAlreadyLaunchedException) { @@ -56,7 +58,7 @@ namespace DiscordChatExporter.Gui.Services if (!_settingsService.IsAutoUpdateEnabled) return; - if (_updateVersion == null || _updaterLaunched) + if (_updateVersion == null || !_updatePrepared || _updaterLaunched) return; try