From b05c10102148a388a5abedc890db52abc70d71b5 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 3 Sep 2020 19:51:50 +0200 Subject: Fix null errors in qml --- resources/qml/TimelineView.qml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'resources/qml/TimelineView.qml') diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 49f523a5..e4643635 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -167,8 +167,9 @@ Page { width: avatarSize height: avatarSize - url: chat.model.roomAvatarUrl.replace("mxc://", "image://MxcImage/") - displayName: chat.model.roomName + + url: chat.model ? chat.model.roomAvatarUrl.replace("mxc://", "image://MxcImage/") : "" + displayName: chat.model ? chat.model.roomName : qsTr("No room selected") MouseArea { anchors.fill: parent @@ -182,7 +183,8 @@ Page { Layout.row: 0 font.pointSize: fontMetrics.font.pointSize * 1.1 - text: chat.model.roomName + + text: chat.model ? chat.model.roomName : qsTr("No room selected") MouseArea { anchors.fill: parent @@ -193,9 +195,10 @@ Page { Layout.fillWidth: true Layout.column: 2 Layout.row: 1 - text: chat.model.roomTopic Layout.maximumHeight: fontMetrics.lineSpacing * 2 // show 2 lines clip: true + + text: chat.model ? chat.model.roomTopic : "" } ImageButton { @@ -387,7 +390,7 @@ Page { Label { id: userName - text: chat.model.escapeEmoji(modelData.userName) + text: timelineManager.escapeEmoji(modelData.userName) color: timelineManager.userColor(modelData.userId, colors.window) textFormat: Text.RichText -- cgit 1.5.1