Skip to content

Commit

Permalink
Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
jsvgoncalves committed Jan 24, 2014
1 parent 4285347 commit 70c4c7d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/org/up/fe/jsvgoncalves/ssim/firstapp/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,13 @@ private void setMockLocation(String lat, String lon) {
newLocation.setAltitude(0d);

// Calculate the bearing with the previous location.
float bearing = previousLocation.bearingTo(newLocation);
newLocation.setBearing(bearing);
if(previousLocation != null) {
float bearing = previousLocation.bearingTo(newLocation);
newLocation.setBearing(bearing);
} else {
newLocation.setBearing(0f);
}


// Provide the new location.
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Expand Down

0 comments on commit 70c4c7d

Please sign in to comment.