DiveDetailsEdit: make sure model data exists

This gets rid of TypeError messages, but does not appear to affect behaviour
qrc:///qml/DiveDetailsEdit.qml:254: TypeError: Cannot read property 'dive' of null
qrc:///qml/DiveDetailsEdit.qml:228: TypeError: Cannot read property 'dive' of null
qrc:///qml/DiveDetailsEdit.qml:216: TypeError: Cannot read property 'dive' of null
qrc:///qml/DiveDetailsEdit.qml:204: TypeError: Cannot read property 'dive' of null

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
This commit is contained in:
Rick Walsh 2017-08-05 17:08:21 +10:00 committed by Dirk Hohndel
parent 00e401b61f
commit 7e4ba965d1

View file

@ -201,7 +201,8 @@ Item {
}
HintsTextEdit {
id: suitBox
model: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.suitList : null
model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
diveDetailsListView.currentItem.modelData.dive.suitList : null
inputMethodHints: Qt.ImhNoPredictiveText
Layout.fillWidth: true
}
@ -213,7 +214,8 @@ Item {
}
HintsTextEdit {
id: buddyBox
model: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.buddyList : null
model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
diveDetailsListView.currentItem.modelData.dive.buddyList : null
inputMethodHints: Qt.ImhNoPredictiveText
Layout.fillWidth: true
}
@ -225,7 +227,8 @@ Item {
}
HintsTextEdit {
id: divemasterBox
model: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.divemasterList : null
model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
diveDetailsListView.currentItem.modelData.dive.divemasterList : null
inputMethodHints: Qt.ImhNoPredictiveText
Layout.fillWidth: true
}
@ -251,7 +254,8 @@ Item {
}
HintsTextEdit {
id: cylinderBox
model: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.cylinderList : null
model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
diveDetailsListView.currentItem.modelData.dive.cylinderList : null
inputMethodHints: Qt.ImhNoPredictiveText
Layout.fillWidth: true
}