Commit 5ad78bd3 authored by Eric Seidel's avatar Eric Seidel

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
parent 18b78cfa
......@@ -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);
}
......
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment