Skip to content

fix(uikit): guard against empty string conversion on currency swap#594

Merged
nstus merged 1 commit into
tonkeeper:mainfrom
Yny4ii:fix/currency-toggle-empty-value
Apr 30, 2026
Merged

fix(uikit): guard against empty string conversion on currency swap#594
nstus merged 1 commit into
tonkeeper:mainfrom
Yny4ii:fix/currency-toggle-empty-value

Conversation

@Yny4ii

@Yny4ii Yny4ii commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

What's fixed

Fixed a crash when toggling currencies with an empty input value.

Problem

When the user clicked the currency toggle button while the input field was empty (''), the application crashed with the error: Cannot convert non-integer value to bigint.

Root cause

The onToggleCurrency function was calling inputValueToBN() directly on the secondary value without checking if it was empty. When the input was empty, inputValueToBN('') threw an error because it couldn't convert an empty string to a BigNumber/bigint.

Solution

Extracted the secondary value into a variable and added a guard condition to pass new BigNumber(0) instead of trying to convert an empty string.

Demo

Before After
2026-04-20.22.27.03.mov
2026-04-20.22.29.13.mov

@nstus nstus merged commit af524d7 into tonkeeper:main Apr 30, 2026
1 of 9 checks passed
@nstus nstus mentioned this pull request May 4, 2026
28 tasks
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.

2 participants