Skip to content

Commit 5b44208

Browse files
committed
fix: segfault
1 parent d291c74 commit 5b44208

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ pub fn get_config_file_path() -> Result<PathBuf> {
280280
path.push(".config/envx/config.json");
281281
// if it doesn't exist, create it
282282
if !path.exists() {
283-
let default = serde_json::to_string_pretty(&Config::default())?;
283+
let tmp = std::mem::ManuallyDrop::new(Config::default());
284+
let default = serde_json::to_string_pretty(&*tmp)?;
284285
let parent_path =
285286
path.parent().context("Failed to get parent directory")?;
286287
fs::create_dir_all(parent_path)?;

0 commit comments

Comments
 (0)