Skip to content

Guard empty float-or-percent input - #11699

Merged
lanewei120 merged 1 commit into
bambulab:masterfrom
BenJule:fix/empty-float-percent-input
Aug 7, 2026
Merged

Guard empty float-or-percent input#11699
lanewei120 merged 1 commit into
bambulab:masterfrom
BenJule:fix/empty-float-percent-input

Conversation

@BenJule

@BenJule BenJule commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • guard both float-or-percent parsing paths before calling std::string::back()
  • preserve the existing percentage parsing behavior
  • let empty input continue into the existing exception-based validation path

Problem

change_opt_value() called str.back() for coFloatOrPercent and coFloatsOrPercents without first checking whether the input string was empty.

Calling std::string::back() on an empty string is undefined behavior and may crash before the surrounding exception handler can report the invalid value.

Testing

  • verified both parsing paths contain the empty-string guard
  • ran git diff --check
  • ran a targeted GUI.cpp syntax check using an existing compile database

No local full build was performed.

@BenJule
BenJule marked this pull request as ready for review July 25, 2026 14:19
@tonghao-bbl

Copy link
Copy Markdown
Contributor

LGTM @lanewei120

@lanewei120
lanewei120 merged commit 076b645 into bambulab:master Aug 7, 2026
21 checks passed
@lanewei120

Copy link
Copy Markdown
Collaborator

thanks @BenJule

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.

3 participants