Skip to content

Crash in our App fix#1096

Merged
lelandrichardson merged 1 commit intoreact-native-maps:masterfrom
thegdznet:master
Mar 26, 2017
Merged

Crash in our App fix#1096
lelandrichardson merged 1 commit intoreact-native-maps:masterfrom
thegdznet:master

Conversation

@thegdznet
Copy link
Copy Markdown
Contributor

java.lang.NullPointerException: Attempt to invoke virtual method
'com.google.android.gms.maps.Projection
com.google.android.gms.maps.GoogleMap.getProjection()' on a null object
reference
at com.airbnb.android.react.maps.AirMapView$13.run(AirMapView.java:643)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5289)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.ja
va:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

java.lang.NullPointerException: Attempt to invoke virtual method
'com.google.android.gms.maps.Projection
com.google.android.gms.maps.GoogleMap.getProjection()' on a null object
reference
	at com.airbnb.android.react.maps.AirMapView$13.run(AirMapView.java:643)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5289)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.ja
va:899)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
@christopherdro
Copy link
Copy Markdown
Collaborator

lgtm

/cc @felipecsl

LatLngBoundsUtils.BoundsAreDifferent(bounds, lastBoundsEmitted)) {
Projection projection = map.getProjection();
VisibleRegion region = (projection != null) ? projection.getVisibleRegion() : null;
LatLngBounds bounds = (region != null) ? region.latLngBounds : null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you don't need the parenthesis around projection != null and region != null

@thegdznet
Copy link
Copy Markdown
Contributor Author

Many thanx to accept my pull request. Do You know when the changes will be reflected to master?

Concerning the parenthesis, they are there only for visibility. You can remove them if You prefer.

@lelandrichardson lelandrichardson merged commit 9d2a84e into react-native-maps:master Mar 26, 2017
@lelandrichardson
Copy link
Copy Markdown
Collaborator

Thanks for this! Will be cutting a new release wit this in it soon

@Hoolii
Copy link
Copy Markdown

Hoolii commented May 17, 2017

I may be wrong but the stacktrace says that the GoogleMap object is null, not the Projection object.
The fix only does a null check on the Projection object, not the GoogleMap object.
I still have a crash because of this.

@nikolay-radkov
Copy link
Copy Markdown
Contributor

I am also having the same problem with the latest release.

@nikolay-radkov
Copy link
Copy Markdown
Contributor

I've created another Pull request for this issue, you can find it here #1469

pinpong pushed a commit to pinpong/react-native-maps that referenced this pull request Feb 28, 2025
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

Successfully merging this pull request may close these issues.

6 participants