Skip to content

Commit 70c4c7d

Browse files
committed
Fixes #1
1 parent 4285347 commit 70c4c7d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/org/up/fe/jsvgoncalves/ssim/firstapp/MainActivity.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,13 @@ private void setMockLocation(String lat, String lon) {
118118
newLocation.setAltitude(0d);
119119

120120
// Calculate the bearing with the previous location.
121-
float bearing = previousLocation.bearingTo(newLocation);
122-
newLocation.setBearing(bearing);
121+
if(previousLocation != null) {
122+
float bearing = previousLocation.bearingTo(newLocation);
123+
newLocation.setBearing(bearing);
124+
} else {
125+
newLocation.setBearing(0f);
126+
}
127+
123128

124129
// Provide the new location.
125130
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

0 commit comments

Comments
 (0)