Fix panic in calculator when pressing ± after AC (#5352)
* fix: handle empty string in calculator plus-minus button calc_val() panics on empty string when AC is pressed before the plus-minus button. Return 0.0 early for empty input. Fixes #4858 * fix a few ci failures * fix link check --------- Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
1 parent
b7958d3d17
commit
2a34be5815
3 files changed
+8
-4
No files matched your search
@@ -148,6 +148,10 @@ fn app() -> Element {
|
||||
}
|
||||
|
||||
fn calc_val(val: &str) -> f64 {
|
||||
if val.is_empty() {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
let mut temp = String::new();
|
||||
let mut operation = "+".to_string();
|
||||
|
||||
|
||||
@@ -83,9 +83,9 @@ Se você conhece React, então você já conhece o Dioxus.
|
||||
|
||||
## Projetos de Exemplo:
|
||||
|
||||
| Navegador de Arquivos (Desktop) | WiFi Scanner (Desktop) | TodoMVC (Todas as Plataformas) | E-commerce com Tailwind (SSR/LiveView) |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [](https://github.com/DioxusLabs/example-projects/blob/master/file-explorer) | [](/examples/bluetooth-scanner/) | [](https://github.com/DioxusLabs/example-projects/blob/master/todomvc) | [](https://github.com/DioxusLabs/example-projects/blob/master/ecommerce-site) |
|
||||
| Navegador de Arquivos (Desktop) | WiFi Scanner (Desktop) | TodoMVC (Todas as Plataformas) | E-commerce com Tailwind (SSR/LiveView) |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [](https://github.com/DioxusLabs/example-projects/blob/master/file-explorer) | [](../../../examples/01-app-demos/bluetooth-scanner/) | [](https://github.com/DioxusLabs/example-projects/blob/master/todomvc) | [](https://github.com/DioxusLabs/example-projects/blob/master/ecommerce-site) |
|
||||
|
||||
Veja a página [awesome-dioxus](https://github.com/DioxusLabs/awesome-dioxus) para uma lista curada do conteúdo dentro do ecossistema do Dioxus.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ use syn::{BoundLifetimes, ExprClosure};
|
||||
|
||||
/// A closure whose body might not be valid rust code but we want to interpret it regardless.
|
||||
/// This lets us provide expansions in way more cases than normal closures at the expense of an
|
||||
/// increased mainteance burden and complexity.
|
||||
/// increased maintenance burden and complexity.
|
||||
///
|
||||
/// We do our best to reuse the same logic from partial exprs for the body of the PartialClosure.
|
||||
/// The code here is simply stolen from `syn::ExprClosure` and lightly modified to work with
|
||||
|
||||
Reference in new issue
Block a user