aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/instant/src/components/amount_input.tsx9
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/instant/src/components/amount_input.tsx b/packages/instant/src/components/amount_input.tsx
index 29d1bf161..12cb9a48c 100644
--- a/packages/instant/src/components/amount_input.tsx
+++ b/packages/instant/src/components/amount_input.tsx
@@ -29,11 +29,16 @@ export class AmountInput extends React.Component<AmountInputProps> {
</Container>
);
}
- private readonly _handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
+ private _handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
const value = event.target.value;
let bigNumberValue;
if (!_.isEmpty(value)) {
- bigNumberValue = new BigNumber(event.target.value);
+ try {
+ bigNumberValue = new BigNumber(event.target.value);
+ } catch {
+ // We don't want to allow values that can't be a BigNumber, so don't even call onChange.
+ return;
+ }
}
if (!_.isUndefined(this.props.onChange)) {
this.props.onChange(bigNumberValue);