Skip to content

Commit

Permalink
fix null reference error in main content
Browse files Browse the repository at this point in the history
  • Loading branch information
prolic committed Nov 30, 2024
1 parent b856a9c commit cce6d64
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion resources/qml/content/Components/PostContent.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Pane {
modal: true
standardButtons: Dialog.Ok | Dialog.Cancel
anchors.centerIn: parent
width: 300
width: 350

ColumnLayout {
spacing: Constants.spacing_m
Expand Down
19 changes: 10 additions & 9 deletions resources/qml/content/MainContent.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -293,29 +293,30 @@ Rectangle {
height: active ? item.height : 0

sourceComponent: Item {
property var message: modelData
height: privateRowLayout.height + 8

RowLayout {
id: privateRowLayout
width: parent.width
spacing: Constants.spacing_m
y: Constants.spacing_m
layoutDirection: modelData.isOwnMessage ? Qt.RightToLeft : Qt.LeftToRight
layoutDirection: message ? (message.isOwnMessage ? Qt.RightToLeft : Qt.LeftToRight) : Qt.LeftToRight

ProfilePicture {
imageSource: modelData.isOwnMessage ?
imageSource: message ? (message.isOwnMessage ?
Util.getProfilePicture(mypicture, mynpub) :
Util.getProfilePicture(profileData.picture, profileData.npub)
Util.getProfilePicture(profileData.picture, profileData.npub)) : ""
}

Pane {
Layout.fillWidth: true
Layout.maximumWidth: parent.width * 0.7
Layout.rightMargin: modelData.isOwnMessage ? 0 : Constants.spacing_m
Layout.leftMargin: modelData.isOwnMessage ? Constants.spacing_m : 0
Layout.rightMargin: message ? (message.isOwnMessage ? 0 : Constants.spacing_m) : Constants.spacing_m
Layout.leftMargin: message ? Constants.spacing_m : 0
padding: Constants.spacing_m
background: Rectangle {
color: modelData.isOwnMessage ? Material.accentColor : Material.dividerColor
color: message ? (message.isOwnMessage ? Material.accentColor : Material.dividerColor) : Material.dividerColor
radius: 10
}

Expand All @@ -325,14 +326,14 @@ Rectangle {

Text {
Layout.fillWidth: true
text: modelData.content
text: message ? message.content : ""
wrapMode: Text.Wrap
color: Material.foreground
}

Text {
Layout.alignment: modelData.isOwnMessage ? Qt.AlignRight : Qt.AlignLeft
text: modelData.timestamp
Layout.alignment: message ? (message.isOwnMessage ? Qt.AlignRight : Qt.AlignLeft) : Qt.AlignLeft
text: message ? message.timestamp : ""
font: Constants.smallFontMedium
color: Material.secondaryTextColor
opacity: 0.9
Expand Down

0 comments on commit cce6d64

Please sign in to comment.