Skip to content

Commit

Permalink
Merge pull request Azure-Samples#497 from Azure-Samples/NicoleBugFix
Browse files Browse the repository at this point in the history
Checking if getting items from the POIStore results in exception
  • Loading branch information
nicolehaugen committed Apr 11, 2016
2 parents 89ee1cf + ced5ceb commit a6d54f1
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,19 @@ public async Task<bool> StopRecordingTrip()
Logger.Instance.Report(ex);
}

List<POI> poiList = new List<POI>(await StoreManager.POIStore.GetItemsAsync(CurrentTrip.Id));
List<POI> poiList = new List<POI>();
try
{
poiList = new List<POI>(await StoreManager.POIStore.GetItemsAsync(CurrentTrip.Id));
}
catch (Exception ex)
{
//Intermittently, Sqlite will cause a crash for WinPhone saying "unable to set temporary directory"
//If this call fails, simply use an empty list of POIs
Logger.Instance.WriteLine("Unable to get POI Store Items.");
Logger.Instance.Report(ex);
}

CurrentTrip.HardStops = poiList.Where(p => p.POIType == POIType.HardBrake).Count();
CurrentTrip.HardAccelerations = poiList.Where(p => p.POIType == POIType.HardAcceleration).Count();

Expand Down

0 comments on commit a6d54f1

Please sign in to comment.