Skip to content

Instantly share code, notes, and snippets.

@TkTech
Created September 6, 2021 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TkTech/83bd5cb855073d67e772e8412b3f28a2 to your computer and use it in GitHub Desktop.
Save TkTech/83bd5cb855073d67e772e8412b3f28a2 to your computer and use it in GitHub Desktop.
diff --git a/smsapp/conversationmodel.cpp b/smsapp/conversationmodel.cpp
index 7cd80abc..755f3796 100644
--- a/smsapp/conversationmodel.cpp
+++ b/smsapp/conversationmodel.cpp
@@ -142,8 +142,11 @@ void ConversationModel::createRowFromMessage(const ConversationMessage& message,
return;
}
- ConversationAddress sender = message.addresses().first();
- QString senderName = message.isIncoming() ? SmsHelper::getTitleForAddresses({sender}) : QString();
+ QList<ConversationAddress> addresses = message.addresses();
+ QString senderName = QString();
+ if (message.isIncoming() && !addresses.isEmpty()) {
+ senderName = SmsHelper::getTitleForAddresses({addresses.first()});
+ }
QString displayBody = message.body();
auto item = new QStandardItem;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment