From 8ba4a9e678bfe6158661c5497a49a5ade7d90982 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 26 Mar 2022 18:38:10 +1100 Subject: [PATCH] Similar checks for other widgets --- lib/widget/category_display.dart | 6 +++++- lib/widget/location_display.dart | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/widget/category_display.dart b/lib/widget/category_display.dart index c28522ff..d0c883e2 100644 --- a/lib/widget/category_display.dart +++ b/lib/widget/category_display.dart @@ -89,7 +89,11 @@ class _CategoryDisplayState extends RefreshableState { // Update the category if (category != null) { - await category!.reload(); + final bool result = await category?.reload() ?? false; + + if (!result) { + Navigator.of(context).pop(); + } } // Request a list of sub-categories under this one diff --git a/lib/widget/location_display.dart b/lib/widget/location_display.dart index fb88381d..0c2fd3a3 100644 --- a/lib/widget/location_display.dart +++ b/lib/widget/location_display.dart @@ -119,7 +119,11 @@ class _LocationDisplayState extends RefreshableState { // Reload location information if (location != null) { - await location?.reload(); + final bool result = await location?.reload() ?? false; + + if (!result) { + Navigator.of(context).pop(); + } } // Request a list of sub-locations under this one