Skip to content

Commit

Permalink
Fix possible npe
Browse files Browse the repository at this point in the history
  • Loading branch information
Chumva committed Jul 25, 2023
1 parent 848b550 commit e214891
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,17 @@ private void updateMarker(@Nullable Location location, @Nullable PointI target31
updateMarkerPosition(location, target31, animationDuration);
if (location.hasBearing()) {
float bearing = location.getBearing() - 90.0f;
boolean updateBearing = lastBearingCached == null || Math.abs(bearing - lastBearingCached) > 0.1;
Float cachedBearing = lastBearingCached;
boolean updateBearing = cachedBearing == null || Math.abs(bearing - cachedBearing) > 0.1;
if (updateBearing) {
lastBearingCached = bearing;
updateMarkerBearing(bearing, isAnimateMyLocation());
}
}
}
if (heading != null && showHeadingCached) {
boolean updateHeading = lastHeadingCached == null || Math.abs(heading - lastHeadingCached) > 0.1;
Float cachedHeading = lastHeadingCached;
boolean updateHeading = cachedHeading == null || Math.abs(heading - cachedHeading) > 0.1;
if (updateHeading) {
lastHeadingCached = heading;
updateMarkerHeading(heading);
Expand Down

0 comments on commit e214891

Please sign in to comment.