Skip to content

Commit

Permalink
possible crash fix (#4215)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitrySvetlichny authored Dec 18, 2024
1 parent cfa1d00 commit cbf08dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Helpers/OALocationParser.mm
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,12 @@ + (NSString *)prepareLatLonWithDecimalCommas:(NSString *)ll
for (int i = DIGITS_BEFORE_COMMA, first = -1; i < ll.length - DIGITS_AFTER_COMMA; i++) {
if ([ll characterAtIndex:i] == ',') {
int before = 0, after = 0;
for (int j = i - 1; j >= i - DIGITS_BEFORE_COMMA; j--) {
for (int j = i - 1; j >= i - DIGITS_BEFORE_COMMA && j >= 0; j--) {
if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[ll characterAtIndex:j]]) {
before++;
}
}
for (int j = i + 1; j <= i + DIGITS_AFTER_COMMA && before >= DIGITS_BEFORE_COMMA; j++) {
for (int j = i + 1; j <= i + DIGITS_AFTER_COMMA && j < ll.length && before >= DIGITS_BEFORE_COMMA; j++) {
if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[ll characterAtIndex:j]]) {
after++;
}
Expand Down

0 comments on commit cbf08dd

Please sign in to comment.