fix bug of npe
This commit is contained in:
@@ -197,21 +197,23 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
|
||||
@Override
|
||||
public void onArriveAt(AutopilotStationInfo data) {
|
||||
try {
|
||||
Logger.d(TAG, "onArriveAt data : " + data.toString());
|
||||
double endLat = data.getLat();
|
||||
double endLon = data.getLon();
|
||||
// 计算是不是到了终点
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(receiverBean.getEndLon(), receiverBean.getEndLat()
|
||||
, endLon, endLat);
|
||||
Logger.d(TAG, "onArriveAt cal distance : " + distanceFromSelf);
|
||||
if (distanceFromSelf < 10) {
|
||||
Logger.d(TAG, "onArriveAt end location");
|
||||
isDispatch = false;
|
||||
isArriveEnd = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(!isDispatch){
|
||||
return;
|
||||
}
|
||||
if(data == null){
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "onArriveAt data : " + data.toString());
|
||||
double endLat = data.getLat();
|
||||
double endLon = data.getLon();
|
||||
// 计算是不是到了终点
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(receiverBean.getEndLon(), receiverBean.getEndLat()
|
||||
, endLon, endLat);
|
||||
Logger.d(TAG, "onArriveAt cal distance : " + distanceFromSelf);
|
||||
if (distanceFromSelf < 10) {
|
||||
Logger.d(TAG, "onArriveAt end location");
|
||||
isDispatch = false;
|
||||
isArriveEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user