diff --git a/src/config/config_type.rs b/src/config/config_type.rs index 2eff7561392..d8fd8f78b38 100644 --- a/src/config/config_type.rs +++ b/src/config/config_type.rs @@ -299,6 +299,8 @@ macro_rules! create_config { Err(msg) => eprintln!("Warning for license template file {:?}: {}", lt_path, msg), } + } else { + self.license_template = None; } } } diff --git a/src/config/mod.rs b/src/config/mod.rs index bb86a379eb1..9abc9f9c331 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -491,6 +491,18 @@ mod test { assert!(config.license_template.is_some()); } + #[test] + fn test_override_existing_license_with_no_license() { + if !crate::is_nightly_channel!() { + return; + } + let toml = r#"license_template_path = "tests/license-template/lt.txt""#; + let mut config = Config::from_toml(toml, Path::new("")).unwrap(); + assert!(config.license_template.is_some()); + config.override_value("license_template_path", ""); + assert!(config.license_template.is_none()); + } + #[test] fn test_dump_default_config() { let default_config = format!(