Hack around Fitness.app crashing if it can't load data

I'm not sure this is the correct approach, but it
at least mitigates https://github.com/domokit/sky_engine/issues/804
for now.

I also made it not crash if you haven't set a goalWeight.

@collinjackson
This commit is contained in:
Eric Seidel
2015-08-25 13:09:50 -07:00
parent 18b78cfafa
commit 5ad78bd3bc
2 changed files with 5 additions and 2 deletions

View File

@@ -194,7 +194,7 @@ class FeedFragment extends StatefulComponent {
dataSet.add(new Point(x, y));
}
}
if (userData.goalWeight > 0.0) {
if (userData.goalWeight != null && userData.goalWeight > 0.0) {
startY = math.min(startY, userData.goalWeight);
endY = math.max(endY, userData.goalWeight);
}

View File

@@ -92,7 +92,10 @@ class FitnessApp extends App {
super.didMount();
loadFitnessData().then((UserData data) {
setState(() => _userData = data);
}).catchError((e) => print("Failed to load data: $e"));
}).catchError((e) {
print("Failed to load data: $e");
setState(() => _userData = new UserDataImpl());
});
}
void initState() {