Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-12466

libc++abi.dylib: terminating with uncaught exception of type std::logic_error: basic_string::_S_construct NULL not valid

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Invalid
    • 6.3.0
    • None
    • None
    • iOS v9.3.5

    Description

      We were running into strange crashes on a WIFI only iPad Mini running iOS v9.3.5 when WIFI was disabled, the error was:

      libc++abi.dylib: terminating with uncaught exception of type std::logic_error: basic_string::_S_construct NULL not valid

      We eventually traced it back to the following code, that only crashed when the error message returned from the OS contained a special character. See the comments where we force the error message to the one returned by the OS with a special character vs. a test message without that one character.

      • (void)locationManager:(CLLocationManager*)manager didFailWithError:(NSError*)error
        {
        NSLog(@"locationManager::didFailWithError %@", [error localizedFailureReason]);

      CDVLocationData* lData = self.locationData;
      if (lData && __locationStarted) {
      // TODO: probably have to once over the various error codes and return one of:
      // PositionError.PERMISSION_DENIED = 1;
      // PositionError.POSITION_UNAVAILABLE = 2;
      // PositionError.TIMEOUT = 3;
      NSUInteger positionError = POSITIONUNAVAILABLE;
      if (error.code == kCLErrorDenied)

      { positionError = PERMISSIONDENIED; }

      // Issue #1279 - seems cordova framework does not support characer ’ (Alt + 0180)
      NSString *errorMessage = @"The operation couldn’t be completed. (kCLErrorDomain error 0.)"; //App crashes
      //NSString *errorMessage = @"The operation couldn't be completed. (kCLErrorDomain error 0.)"; //App does not crash
      //[self returnLocationError:positionError withMessage:[error localizedDescription]];
      [self returnLocationError:positionError withMessage:errorMessage];
      }

      if (error.code != kCLErrorLocationUnknown)

      { [self.locationManager stopUpdatingLocation]; __locationStarted = NO; }

      }

      We were not able to replicate this issue on iOS v10+ though, however it did seem to be somewhat timing related as to when that specific error message was returned and therefore causes the crash.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mike.benoit Mike Benoit
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: