Skip to content

Commit

Permalink
Merge pull request flutter#806 from eseidelGoogle/fitness_crash
Browse files Browse the repository at this point in the history
Hack around Fitness.app crashing if it can't load data
  • Loading branch information
eseidelGoogle committed Aug 25, 2015
2 parents c7023bd + 9085b8a commit aaf974b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/fitness/lib/feed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 4 additions & 1 deletion examples/fitness/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit aaf974b

Please sign in to comment.