Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank field user types character crash #18

Open
dulbrich opened this issue Mar 16, 2016 · 3 comments
Open

Blank field user types character crash #18

dulbrich opened this issue Mar 16, 2016 · 3 comments

Comments

@dulbrich
Copy link

If you have a blank BKCurrencyTextField and you try and type or paste a letter character rather than a number character it crashes the app.

Here's the error:

2016-03-16 15:34:32.494 Alder[68142:1267089] *** Terminating app due to uncaught exception 'NSDecimalNumberOverflowException', reason: 'NSDecimalNumber overflow exception'

0 CoreFoundation 0x0000000107d54e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001077cddeb objc_exception_throw + 48
2 CoreFoundation 0x0000000107d54d9d +[NSException raise:format:] + 205
3 Foundation 0x000000010747db48 -[NSDecimalNumberHandler exceptionDuringOperation:error:leftOperand:rightOperand:] + 193
4 Foundation 0x000000010747c976 _checkErrorAndRound + 65
5 Foundation 0x000000010747cd46 -[NSDecimalNumber decimalNumberByDividingBy:withBehavior:] + 159
6 BKMoneyKit 0x00000001062e06ba -[BKCurrencyTextField textField:shouldChangeCharactersInRange:replacementString:] + 1370

@ErasmoOliveira87
Copy link

Hi, I found the same issue, I create a fix in BKCurrencyTextField.m in line 67, Its a workaround, but solve my problem.

if (self.numberFormatter.maximumFractionDigits > 0) {

    if ([decimalNumber isEqualToNumber:[NSDecimalNumber notANumber]]) {

        decimalNumber = 0;

    }else{

        decimalNumber = [decimalNumber decimalNumberByDividingBy:[NSDecimalNumber decimalNumberWithMantissa:1 exponent:self.numberFormatter.maximumFractionDigits isNegative:NO]];

    }
}

@Alibk129
Copy link

Terminate block

@Alibk129
Copy link

If you have a blank BKCurrencyTextField and you try and type or paste a letter character rather than a number character it crashes the app.

Here's the error:

2016-03-16 15:34:32.494 Alder[68142:1267089] *** Terminating app due to uncaught exception 'NSDecimalNumberOverflowException', reason: 'NSDecimalNumber overflow exception'

0 CoreFoundation 0x0000000107d54e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001077cddeb objc_exception_throw + 48
2 CoreFoundation 0x0000000107d54d9d +[NSException raise:format:] + 205
3 Foundation 0x000000010747db48 -[NSDecimalNumberHandler exceptionDuringOperation:error:leftOperand:rightOperand:] + 193
4 Foundation 0x000000010747c976 _checkErrorAndRound + 65
5 Foundation 0x000000010747cd46 -[NSDecimalNumber decimalNumberByDividingBy:withBehavior:] + 159
6 BKMoneyKit 0x00000001062e06ba -[BKCurrencyTextField textField:shouldChangeCharactersInRange:replacementString:] + 1370

Disable / terminate code

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

No branches or pull requests

3 participants