Skip to content

Commit

Permalink
fix(utils/config): fix parsing f64 values, closes #8252 (#8407)
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Dec 18, 2023
1 parent 50e9caa commit 9b230de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/config-f64-deserialize.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-utils': 'patch:bug'
---

Fix compile error when parsing config that includes float values.
2 changes: 1 addition & 1 deletion core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3214,7 +3214,7 @@ mod build {
} else if num.is_f64() {
// guaranteed f64
let num = num.as_f64().unwrap();
quote! { #prefix::Number(#num.into()) }
quote! { #prefix::Number(::serde_json::Number::from_f64(#num).unwrap(/* safe to unwrap, guaranteed f64 */)) }
} else {
// invalid number
quote! { #prefix::Null }
Expand Down

0 comments on commit 9b230de

Please sign in to comment.