Skip to content

Fix panic in calculator when pressing ± after AC#5352

Open
Bortlesboat wants to merge 1 commit intoDioxusLabs:mainfrom
Bortlesboat:fix-calculator-panic
Open

Fix panic in calculator when pressing ± after AC#5352
Bortlesboat wants to merge 1 commit intoDioxusLabs:mainfrom
Bortlesboat:fix-calculator-panic

Conversation

@Bortlesboat
Copy link

Pressing AC clears the display to an empty string, then pressing ± calls calc_val("") which panics at &val[0..1] because byte index 1 is out of bounds. Added an early return of 0.0 for empty input.

Fixes #4858

calc_val() panics on empty string when AC is pressed before the
plus-minus button. Return 0.0 early for empty input.

Fixes DioxusLabs#4858
@Bortlesboat Bortlesboat requested a review from a team as a code owner March 7, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic in calculator example

1 participant