Skip to content

Commit

Permalink
fix: prevent stack overflow when serializing StartupConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger committed Oct 25, 2024
1 parent 2914bd7 commit 7124d28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/desktop/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl<'de> Deserialize<'de> for StartupConfig {
#[serde(untagged)]
enum StringOrObject {
String(String),
Object(StartupConfig),
Object { path: PathBuf, preset: String },
}

let value = StringOrObject::deserialize(deserializer)?;
Expand All @@ -58,7 +58,9 @@ impl<'de> Deserialize<'de> for StartupConfig {
path: PathBuf::from(s),
preset: "default".to_string(),
},
StringOrObject::Object(obj) => obj,
StringOrObject::Object { path, preset } => {
StartupConfig { path, preset }
}
})
}
}
Expand Down

0 comments on commit 7124d28

Please sign in to comment.