From 93d220127740018c0cd1d9c11c8c3bd32c9040cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Fri, 22 Dec 2023 09:54:22 -0500 Subject: [PATCH] contactmodel: avoid crash on incorrect profile Change-Id: I1aa09e72e7db602a489c1195ab45b897e18370bc --- extras/packaging/gnu-linux/Makefile | 2 +- src/libclient/contactmodel.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/extras/packaging/gnu-linux/Makefile b/extras/packaging/gnu-linux/Makefile index 2b36fb75c..7537a3607 100644 --- a/extras/packaging/gnu-linux/Makefile +++ b/extras/packaging/gnu-linux/Makefile @@ -47,7 +47,7 @@ DEBIAN_DSC_FILENAME := jami_$(DEBIAN_VERSION).dsc # Qt versions QT_MAJOR := 6 QT_MINOR := 5 -QT_PATCH := 3 +QT_PATCH := 4 QT_TARBALL_CHECKSUM := 7cda4d119aad27a3887329cfc285f2aba5da85601212bcb0aea27bd6b7b544cb DEBIAN_QT_VERSION := $(QT_MAJOR).$(QT_MINOR).$(QT_PATCH)-0 DEBIAN_QT_DSC_FILENAME := libqt-jami_$(DEBIAN_QT_VERSION).dsc diff --git a/src/libclient/contactmodel.cpp b/src/libclient/contactmodel.cpp index 620f78917..5d030e4e4 100644 --- a/src/libclient/contactmodel.cpp +++ b/src/libclient/contactmodel.cpp @@ -1207,11 +1207,17 @@ ContactModelPimpl::slotProfileReceived(const QString& accountId, profileInfo.uri = peer; profileInfo.type = profile::Type::JAMI; - for (auto& e : QString(vCard).split("\n")) - if (e.contains("PHOTO")) - profileInfo.avatar = e.split(":")[1]; - else if (e.contains("FN")) - profileInfo.alias = e.split(":")[1]; + for (auto& e : QString(vCard).split("\n")) { + if (e.contains("PHOTO")) { + auto splitted = e.split(":"); + if (splitted.size() > 1) + profileInfo.avatar = e.split(":")[1]; + } else if (e.contains("FN")) { + auto splitted = e.split(":"); + if (splitted.size() > 1) + profileInfo.alias = e.split(":")[1]; + } + } if (peer == linked.owner.profileInfo.uri) { auto avatarChanged = profileInfo.avatar != linked.owner.profileInfo.avatar; -- GitLab