From ced5ceb2d706df616307200660e3c48cfd051136 Mon Sep 17 00:00:00 2001 From: Nicole Haugen Date: Mon, 11 Apr 2016 16:35:02 -0500 Subject: [PATCH] Checking if getting items from the POIStore results in exception --- .../MyDriving/ViewModel/CurrentTripViewModel.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/MobileApps/MyDriving/MyDriving/ViewModel/CurrentTripViewModel.cs b/src/MobileApps/MyDriving/MyDriving/ViewModel/CurrentTripViewModel.cs index c4ee26ac..8e53d827 100644 --- a/src/MobileApps/MyDriving/MyDriving/ViewModel/CurrentTripViewModel.cs +++ b/src/MobileApps/MyDriving/MyDriving/ViewModel/CurrentTripViewModel.cs @@ -291,7 +291,19 @@ public async Task StopRecordingTrip() Logger.Instance.Report(ex); } - List poiList = new List(await StoreManager.POIStore.GetItemsAsync(CurrentTrip.Id)); + List poiList = new List(); + try + { + poiList = new List(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();