aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-22 17:06:29 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-26 11:38:26 -0700
commit4c55074bd771240848967a183a3681bfc8e14b8c (patch)
tree8dd79d47c63a98b2d0c9ad9f174fda676f5741f1 /mobile-widgets/qml
parentdc5f22d04705989b53adf4613aff9def766ab33e (diff)
downloadsubsurface-4c55074bd771240848967a183a3681bfc8e14b8c.tar.gz
Mobile: more code to deal with undefined elements
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r--mobile-widgets/qml/DiveDetails.qml20
1 files changed, 11 insertions, 9 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml
index a30984a9a..db99879d4 100644
--- a/mobile-widgets/qml/DiveDetails.qml
+++ b/mobile-widgets/qml/DiveDetails.qml
@@ -216,14 +216,16 @@ Kirigami.Page {
}
onCurrentItemChanged: {
- // why do we do this? What consumes this?
- manager.selectedDiveTimestamp = currentItem.modelData.date
- // make sure the core data structures reflect that this dive is selected
- manager.selectDive(currentItem.modelData.id)
- // update the map to show the highlighted flag and center on it
- if (rootItem.pageIndex(mapPage) !== -1) {
- mapPage.reloadMap()
- mapPage.centerOnDiveSite(currentItem.modelData.diveSite)
+ if (currentItem && currentItem.modelData) {
+ // this is used when loading dives to maintain relative position in the dive list
+ manager.selectedDiveTimestamp = currentItem.modelData.date
+ // make sure the core data structures reflect that this dive is selected
+ manager.selectDive(currentItem.modelData.id)
+ // update the map to show the highlighted flag and center on it
+ if (rootItem.pageIndex(mapPage) !== -1) {
+ mapPage.reloadMap()
+ mapPage.centerOnDiveSite(currentItem.modelData.diveSite)
+ }
}
}
@@ -256,7 +258,7 @@ Kirigami.Page {
dive_id = modelData.id
number = modelData.number
date = modelData.dateTime
- location = modelData.location
+ location = modelData.location !== undefined ? location : ""
locationIndex = manager.locationList.indexOf(modelData.location)
gps = modelData.gps
gpsCheckbox = false