修改可能的空指针

This commit is contained in:
lixiaopeng
2022-07-29 11:40:05 +08:00
parent 3db1163724
commit 42d3c94894

View File

@@ -506,7 +506,9 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public MogoLatLng getWindowCenterLocation() {
try {
return ObjectUtils.fromAMap(mMapView.getMapAutoViewHelper().getCenter());
if (checkAMapView()) {
return ObjectUtils.fromAMap(mMapView.getMapAutoViewHelper().getCenter());
}
} catch (Exception e) {
e.printStackTrace();
}
@@ -813,16 +815,18 @@ public class AMapViewWrapper implements IMogoMapView,
public void onMapLoaded() {
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--onMapLoaded: ");
mMapLoaded = true;
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
Trace.beginSection("timer.onCameraChangeFinish");
MogoMapListenerHandler.getInstance().onMapChanged(ObjectUtils.fromAMap(cameraPosition.getTarget()),
cameraPosition.getZoom(),
cameraPosition.getTilt(),
cameraPosition.getBearing());
Trace.endSection();
initMapView();
initMyLocation();
loadPreVehicleModel();
if (checkAMapView()) {
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
Trace.beginSection("timer.onCameraChangeFinish");
MogoMapListenerHandler.getInstance().onMapChanged(ObjectUtils.fromAMap(cameraPosition.getTarget()),
cameraPosition.getZoom(),
cameraPosition.getTilt(),
cameraPosition.getBearing());
Trace.endSection();
initMapView();
initMyLocation();
loadPreVehicleModel();
}
}
@Override
@@ -1039,7 +1043,9 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void setMapDAngle(float angle) {
mMapView.getMapAutoViewHelper().setMapDAngle(angle);
if (checkAMapView()) {
mMapView.getMapAutoViewHelper().setMapDAngle(angle);
}
}
@Override