summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-08 19:49:48 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-11 11:14:22 -0700
commitf8d551ac6ee68fc90759da915f1a65e40225b661 (patch)
treef15833ed411f3e5c73e7276b9b7953e0e5dfb1a2 /mobile-widgets
parentae6756e7f152ffe284d904261eccf0e9a9f63196 (diff)
downloadsubsurface-f8d551ac6ee68fc90759da915f1a65e40225b661.tar.gz
QML UI: don't show bogus warning if page stack is reset
As we clear all the pages from the stack, we can briefly have no valid currentItem. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/main.qml22
1 files changed, 13 insertions, 9 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index 332e4c921..0a2a95c0a 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -546,18 +546,22 @@ if you have network connectivity and want to sync your data to cloud storage."),
// This is called whenever the user navigates using the breadcrumbs in the header
// disable the left swipe to go back when on the map page
- stackView.interactive = pageStack.currentItem.objectName !== mapPage.objectName
+ if (pageStack.currentItem === null) {
+ console.log("there's no current page")
+ } else {
+ stackView.interactive = pageStack.currentItem.objectName !== mapPage.objectName
- // is there a better way to reload the map markers instead of doing that
- // every time the map page is shown - e.g. link to the dive list model somehow?
- if (pageStack.currentItem.objectName === mapPage.objectName)
- mapPage.reloadMap()
+ // is there a better way to reload the map markers instead of doing that
+ // every time the map page is shown - e.g. link to the dive list model somehow?
+ if (pageStack.currentItem.objectName === mapPage.objectName)
+ mapPage.reloadMap()
- // In case we land on any page, not being the DiveDetails (which can be
- // in multiple states, such as add, edit or view), just end the edit/add mode
- if (pageStack.currentItem.objectName !== "DiveDetails" &&
- (detailsWindow.state === 'edit' || detailsWindow.state === 'add')) {
+ // In case we land on any page, not being the DiveDetails (which can be
+ // in multiple states, such as add, edit or view), just end the edit/add mode
+ if (pageStack.currentItem.objectName !== "DiveDetails" &&
+ (detailsWindow.state === 'edit' || detailsWindow.state === 'add')) {
detailsWindow.endEditMode()
+ }
}
}