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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user