From 7e4ba965d19edf9d3265592af66747cfc27968dd Mon Sep 17 00:00:00 2001 From: Rick Walsh Date: Sat, 5 Aug 2017 17:08:21 +1000 Subject: 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 --- mobile-widgets/qml/DiveDetailsEdit.qml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml index 3d1b31194..79bd5724e 100644 --- a/mobile-widgets/qml/DiveDetailsEdit.qml +++ b/mobile-widgets/qml/DiveDetailsEdit.qml @@ -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 } -- cgit v1.2.3-70-g09d2