Skip to content

[Bug]: Crash - Attempt to invoke getExtras on a null object reference #2520

@blwinters

Description

@blwinters

Required Reading

  • Confirmed

Plugin Version

5.0.3

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

Samsung Galaxy Note 20, Samsung Galaxy S20, T-Mobile Revvl 6, Motorola g stylus 5G

Device operating-systems(s)

Android 12, 13

React Native / Expo version

0.81.5, Expo 54.0.20

What happened?

java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Bundle android.location.Location.getExtras()' on a null object reference
	at com.transistorsoft.locationmanager.location.TSLocation.a(r8-map-id-15da3e1f1d25245b18b4b97a37d84f0c8d720e9acd6160d4e7b38ffbf5d3fe70:72)
	at com.transistorsoft.locationmanager.location.TSLocation.<init>(r8-map-id-15da3e1f1d25245b18b4b97a37d84f0c8d720e9acd6160d4e7b38ffbf5d3fe70:224)
	at com.transistorsoft.locationmanager.location.TSLocationManager.buildTSLocation(r8-map-id-15da3e1f1d25245b18b4b97a37d84f0c8d720e9acd6160d4e7b38ffbf5d3fe70:1)
	at com.transistorsoft.locationmanager.location.TSLocationManager.onSingleLocationResult(r8-map-id-15da3e1f1d25245b18b4b97a37d84f0c8d720e9acd6160d4e7b38ffbf5d3fe70:70)
	at com.transistorsoft.locationmanager.service.LocationRequestService.c(r8-map-id-15da3e1f1d25245b18b4b97a37d84f0c8d720e9acd6160d4e7b38ffbf5d3fe70:45)
	at com.transistorsoft.locationmanager.service.LocationRequestService.a(r8-map-id-15da3e1f1d25245b18b4b97a37d84f0c8d720e9acd6160d4e7b38ffbf5d3fe70:1)
	at com.transistorsoft.locationmanager.service.LocationRequestService$a.run(r8-map-id-15da3e1f1d25245b18b4b97a37d84f0c8d720e9acd6160d4e7b38ffbf5d3fe70:5)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1154)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:652)
	at java.lang.Thread.run(Thread.java:1564)

Plugin Code and/or Config

{
  logger: {
    debug: false,
    logLevel: __DEV__ ? BackgroundGeolocation.LogLevel.Verbose : BackgroundGeolocation.LogLevel.Debug,
  },
  geolocation: {
    desiredAccuracy:
      Platform.OS === 'ios'
        ? BackgroundGeolocation.DesiredAccuracy.Navigation
        : BackgroundGeolocation.DesiredAccuracy.High,
    distanceFilter: 30,    
    stopTimeout: 5,
    locationAuthorizationRequest: 'Always',
    locationAuthorizationAlert: getLocationAuthorizationAlert(),
    activityType: BackgroundGeolocation.ActivityType.AutomotiveNavigation,
  },
  http: {
    url: EnvConfig.apiBaseUrl + 'locations/log/',
    autoSync: true,
    timeout: 15000,
  },
  app: {
    stopOnTerminate: false,
    startOnBoot: true,
    heartbeatInterval: 60,
    preventSuspend: true,
    backgroundPermissionRationale: getBackgroundPermissionRationale(),
  },
  persistence: {
    extras: {
      driver: '',
      assignment: '',
      trips: [],
      attendants: [],
    },
  },
}

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions