r450 - trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/device/gps
Author: fdesbois Date: 2012-08-20 17:11:50 +0200 (Mon, 20 Aug 2012) New Revision: 450 Url: http://forge.codelutin.com/repositories/revision/sammoa/450 Log: resolve NPE in FakeGpsHandler Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/device/gps/FakeGpsHandler.java Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/device/gps/FakeGpsHandler.java =================================================================== --- trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/device/gps/FakeGpsHandler.java 2012-08-20 14:27:46 UTC (rev 449) +++ trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/device/gps/FakeGpsHandler.java 2012-08-20 15:11:50 UTC (rev 450) @@ -131,11 +131,16 @@ @Override public GeoPoint getCurrentLocation() { GeoPoint result; - // Location already saved, return null (i.e. no new location) - if (currentLocation == null || currentLocation.getTopiaId() != null) { + if (currentLocation == null) { result = new GeoPointImpl(GeoPoints.EMPTY_COORDINATE, GeoPoints.EMPTY_COORDINATE); - currentLocation.setRecordTime(new Date()); + result.setRecordTime(new Date()); + } else if (currentLocation.getTopiaId() != null) { + result = new GeoPointImpl(currentLocation.getLatitude(), currentLocation.getLongitude()); + result.setAltitude(currentLocation.getAltitude()); + result.setSpeed(currentLocation.getSpeed()); + result.setRecordTime(new Date()); + } else { result = currentLocation; }
participants (1)
-
fdesbois@users.forge.codelutin.com