Check for invalid strings in BigNumber constructor. (#219)
This commit is contained in:
parent
b1d026b800
commit
8e83ceaedc
@ -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') {
|
||||
|
Loading…
Reference in New Issue
Block a user