Commit 3ee78ead authored by Simon Redman's avatar Simon Redman
Browse files

[SMS App] Prevent crash if a conversation doesn't have any messages

## Summary

Fix crash in kdeconnect-sms if a conversation contains a message which has no addresses.

I am not sure why this would happen and there's probably something which should be fixed on the Android side to ensure that every message has addresses, but this is an easy fix to prevent user-reported crashes.

BUG: 449719

## Test Plan

### Before:
kdeconnect-sms crashes upon selecting a conversation with a message with no addresses

### After:
kdeconnect-sms does not crash
parent 035a0d6c
Pipeline #146146 passed with stage
in 1 minute and 58 seconds
......@@ -142,7 +142,15 @@ void ConversationModel::createRowFromMessage(const ConversationMessage& message,
ConversationAddress sender = message.addresses().first();
ConversationAddress sender;
if (!message.addresses().isEmpty()) {
sender = message.addresses().first();
else {
<< "Conversation with ID " << message.threadID() << " did not have any addresses";
QString senderName = message.isIncoming() ? SmsHelper::getTitleForAddresses({sender}) : QString();
QString displayBody = message.body();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment