From 8e83ceaedc11e414a432934bf6c87c869665d657 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Tue, 3 Jul 2018 14:58:24 -0400 Subject: [PATCH] Check for invalid strings in BigNumber constructor. (#219) --- src.ts/utils/bignumber.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src.ts/utils/bignumber.ts b/src.ts/utils/bignumber.ts index 4df3c3038..07532953b 100644 --- a/src.ts/utils/bignumber.ts +++ b/src.ts/utils/bignumber.ts @@ -45,6 +45,9 @@ export class BigNumber { } else if (value.match(/^-?[0-9]*$/)) { if (value == '') { value = '0'; } defineReadOnly(this, '_bn', new BN.BN(value)); + + } else { + errors.throwError('invalid BigNumber string value', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } } else if (typeof(value) === 'number') {