summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTobias Järvelöv <tobias.jarvelov@mullvad.net>2025-09-01 14:10:11 +0200
committerTobias Järvelöv <tobias.jarvelov@mullvad.net>2025-09-30 09:51:49 +0200
commitd6aa77cfa6b882e6b97c37ddaf8279e1cd5faa0a (patch)
treef2dc6c56d6312d21d63d5e1d76b0855d50d39c2b
parent1eac15de8c5dff8d6109d11ab5309ca03ee12077 (diff)
downloadmullvadvpn-d6aa77cfa6b882e6b97c37ddaf8279e1cd5faa0a.tar.xz
mullvadvpn-d6aa77cfa6b882e6b97c37ddaf8279e1cd5faa0a.zip
Verify that an access method has a unique name before appending
-rw-r--r--mullvad-types/src/access_method.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/mullvad-types/src/access_method.rs b/mullvad-types/src/access_method.rs
index 956bb8492f..12040bf4c1 100644
--- a/mullvad-types/src/access_method.rs
+++ b/mullvad-types/src/access_method.rs
@@ -30,8 +30,10 @@ impl Settings {
}
/// Append an [`AccessMethod`] to the end of `api_access_methods`.
- pub fn append(&mut self, api_access_method: AccessMethodSetting) {
- self.custom.push(api_access_method)
+ pub fn append(&mut self, api_access_method: AccessMethodSetting) -> Result<(), Error> {
+ self.check_custom_access_method_name_is_unique(&api_access_method)?;
+ self.custom.push(api_access_method);
+ Ok(())
}
/// Remove an [`AccessMethod`] from `api_access_methods`.