280 修复marker npe

This commit is contained in:
lianglihui
2022-06-21 15:55:39 +08:00
parent 95662f7d69
commit d187ecd20a

View File

@@ -166,13 +166,17 @@ public class SmallMapDirectionView
if (location == null) {
return;
}
if (mCarMarker == null){
mCarMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_my_location_logo))
.anchor(0.5f, 0.5f));
}
if(mCarMarker == null){
return;
}
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
//更新车辆位置
if (mCarMarker != null) {
// mCarMarker.setRotateAngle(location.getBearing());
mCarMarker.setPosition(currentLatLng);
// mCarMarker.setToTop();
}
mCarMarker.setPosition(currentLatLng);
CameraPosition cameraPosition;
if (mCoordinatesLatLng.size() > 1) {