From ee1642a50f4eee3e79a4d19d073e3bb817a205e7 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 8 Apr 2024 19:30:47 -0400 Subject: [PATCH] Fix broken loading of `auto_update` setting (#10301) This PR fixes a panic when attempting to load the `auto_update` setting. This was leftover from #10296. I'm going to see if there's a better way we can handle these cases so they're more obviously correct. Release Notes: - N/A --- crates/auto_update/src/auto_update.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/crates/auto_update/src/auto_update.rs b/crates/auto_update/src/auto_update.rs index 7ba1a55fb4..9e41d7248f 100644 --- a/crates/auto_update/src/auto_update.rs +++ b/crates/auto_update/src/auto_update.rs @@ -92,14 +92,19 @@ impl Settings for AutoUpdateSetting { type FileContent = AutoUpdateSettingOverride; fn load(sources: SettingsSources, _: &mut AppContext) -> Result { - Ok(Self( - sources - .release_channel - .or(sources.user) - .unwrap_or(sources.default) - .0 - .ok_or_else(Self::missing_default)?, - )) + if let Some(release_channel_value) = sources.release_channel { + if let Some(value) = release_channel_value.0 { + return Ok(Self(value)); + } + } + + if let Some(user_value) = sources.user { + if let Some(value) = user_value.0 { + return Ok(Self(value)); + } + } + + Ok(Self(sources.default.0.ok_or_else(Self::missing_default)?)) } }