fix crash when account null

fix notification display if max instances reached
This commit is contained in:
gaelle 2025-11-26 16:53:35 +01:00
parent e3edeb1bcf
commit 5bbffa79d8
4 changed files with 18 additions and 17 deletions

View file

@ -130,7 +130,7 @@ Notifier::~Notifier() {
bool Notifier::createNotification(Notifier::NotificationType type, QVariantMap data) {
mMutex->lock();
// Q_ASSERT(mInstancesNumber <= MaxNotificationsNumber);
if (mInstancesNumber == MaxNotificationsNumber) { // Check existing instances.
if (mInstancesNumber >= MaxNotificationsNumber) { // Check existing instances.
qWarning() << QStringLiteral("Unable to create another notification.");
mMutex->unlock();
return false;
@ -332,7 +332,8 @@ void Notifier::notifyReceivedMessages(const std::shared_ptr<linphone::ChatRoom>
if (receiverAccount) {
auto senderAccount = ToolModel::findAccount(message->getFromAddress());
auto currentAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
if (senderAccount && senderAccount->getContactAddress()->weakEqual(currentAccount->getContactAddress())) {
if (senderAccount && senderAccount->getContactAddress() && currentAccount->getContactAddress() &&
senderAccount->getContactAddress()->weakEqual(currentAccount->getContactAddress())) {
qDebug() << "sender is current account, return";
return;
}

View file

@ -5017,30 +5017,30 @@ Error</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="361"/>
<location filename="../../core/notifier/Notifier.cpp" line="362"/>
<source>new_voice_message</source>
<extracomment>&apos;Voice message received!&apos; : message to warn the user in a notofication for voice messages.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="362"/>
<location filename="../../core/notifier/Notifier.cpp" line="363"/>
<source>new_file_message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="365"/>
<location filename="../../core/notifier/Notifier.cpp" line="366"/>
<source>new_conference_invitation</source>
<extracomment>&apos;Conference invitation received!&apos; : Notification about receiving an invitation to a conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="386"/>
<location filename="../../core/notifier/Notifier.cpp" line="387"/>
<source>new_chat_room_messages</source>
<extracomment>&apos;New messages received!&apos; Notification that warn the user of new messages.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="414"/>
<location filename="../../core/notifier/Notifier.cpp" line="415"/>
<source>new_message_alert_accessible_name</source>
<extracomment>New message on chatroom %1</extracomment>
<translation type="unfinished"></translation>

View file

@ -4924,30 +4924,30 @@ Expiration : %1</translation>
<translation>New call from %1</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="361"/>
<location filename="../../core/notifier/Notifier.cpp" line="362"/>
<source>new_voice_message</source>
<extracomment>&apos;Voice message received!&apos; : message to warn the user in a notofication for voice messages.</extracomment>
<translation>Voice message received!</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="362"/>
<location filename="../../core/notifier/Notifier.cpp" line="363"/>
<source>new_file_message</source>
<translation>File received!</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="365"/>
<location filename="../../core/notifier/Notifier.cpp" line="366"/>
<source>new_conference_invitation</source>
<extracomment>&apos;Conference invitation received!&apos; : Notification about receiving an invitation to a conference.</extracomment>
<translation>Conference invitation received !</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="386"/>
<location filename="../../core/notifier/Notifier.cpp" line="387"/>
<source>new_chat_room_messages</source>
<extracomment>&apos;New messages received!&apos; Notification that warn the user of new messages.</extracomment>
<translation>New messages received !</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="414"/>
<location filename="../../core/notifier/Notifier.cpp" line="415"/>
<source>new_message_alert_accessible_name</source>
<extracomment>New message on chatroom %1</extracomment>
<translation>New message on chatroom %1</translation>

View file

@ -4924,30 +4924,30 @@ Expiration : %1</translation>
<translation>Nouvel appel de %1</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="361"/>
<location filename="../../core/notifier/Notifier.cpp" line="362"/>
<source>new_voice_message</source>
<extracomment>&apos;Voice message received!&apos; : message to warn the user in a notofication for voice messages.</extracomment>
<translation>Message vocal reçu !</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="362"/>
<location filename="../../core/notifier/Notifier.cpp" line="363"/>
<source>new_file_message</source>
<translation>Fichier reçu !</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="365"/>
<location filename="../../core/notifier/Notifier.cpp" line="366"/>
<source>new_conference_invitation</source>
<extracomment>&apos;Conference invitation received!&apos; : Notification about receiving an invitation to a conference.</extracomment>
<translation>Nouvelle invitation à une conférence !</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="386"/>
<location filename="../../core/notifier/Notifier.cpp" line="387"/>
<source>new_chat_room_messages</source>
<extracomment>&apos;New messages received!&apos; Notification that warn the user of new messages.</extracomment>
<translation>Nouveaux messages reçus !</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="414"/>
<location filename="../../core/notifier/Notifier.cpp" line="415"/>
<source>new_message_alert_accessible_name</source>
<extracomment>New message on chatroom %1</extracomment>
<translation>Nouveau message sur la conversation %1</translation>