fix: [updater] crash when updater runs without UI instance

This commit is contained in:
Alexandr Stelnykovych 2025-04-14 10:57:12 +00:00
parent 7d5a8fd1dc
commit f0c71c97d1

View file

@ -24,9 +24,11 @@ func (u *Updater) upgrade(downloader *Downloader, ignoreVersion bool) error {
}
}
// Unload UI assets to be able to move files on Windows.
u.instance.UI().EnableUpgradeLock()
defer u.instance.UI().DisableUpgradeLock()
// If we are running in a UI instance, we need to unload the UI assets
if u.instance != nil {
u.instance.UI().EnableUpgradeLock()
defer u.instance.UI().DisableUpgradeLock()
}
// Execute the upgrade.
upgradeError := u.upgradeMoveFiles(downloader)