airbnb / airbnb/AirMapView

NPE onMapInitialized

Open
#115 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.9k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

Starting at version 1.5.0, we've seen a weird NPE crash in your app:

```
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'com.airbnb.android.airmapview.AirMapInterface com.airbnb.android.airmapview.AirMapView.getMapInterface()' on a null object reference
at br.com.moobie.android.carMaps.CarMapFragment.onMapInitialized(CarMapFragment.java:308)
at com.airbnb.android.airmapview.AirMapView.onMapLoaded(AirMapView.java:416)
at com.airbnb.android.airmapview.NativeGoogleMapFragment$1.onMapReady(NativeGoogleMapFragment.java:78)
at com.google.android.gms.maps.zzaj.zza(Unknown Source)
at com.google.android.gms.maps.internal.zzaq.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:387)
at fv.b(:com.google.android.gms.DynamiteModulesB@11745436:20)
at com.google.android.gms.maps.internal.bf.a(:com.google.android.gms.DynamiteModulesB@11745436:5)
at com.google.maps.api.android.lib6.impl.bc.run(:com.google.android.gms.DynamiteModulesB@11745436:5)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
```

I've tried to reproduce the error but I couldn't so far.
In the latter version (1.4.0) everything was working properly, I'm suspecting it might be related with the Google Play Services bump #98, but I'm not sure.

My onMapInitialized:
```java
@Override
public void onMapInitialized() {
map.getMapInterface().setMapToolbarEnabled(false);
....
}
```

```java
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
map.setOnCameraChangeListener(this);
map.setOnMarkerClickListener(this);
map.setOnMapInitializedListener(this);
map.initialize(getChildFragmentManager());
}
```

Is there anyone else facing this issue?

Thanks!

Contributor guide

Open the contributing guide

Research direction

Trace the callback from AirMapView.onMapLoaded through NativeGoogleMapFragment.onMapReady to CarMapFragment.onMapInitialized, using the reported stack trace and lifecycle snippets as the starting points. Determine when the map reference is null and verify that the reported crash no longer occurs under that lifecycle condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.