From 6baf2e4888448edbdad0a843ec4a50f96349638e Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Fri, 24 Nov 2023 18:50:30 +0100 Subject: [PATCH] Fix crash for invalid media uris BUG: 476698 --- src/eventhandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/eventhandler.cpp b/src/eventhandler.cpp index c518f30a1..de3685ba5 100644 --- a/src/eventhandler.cpp +++ b/src/eventhandler.cpp @@ -685,12 +685,12 @@ QVariantMap EventHandler::getMediaInfoFromFileInfo(const EventContent::FileInfo QVariantMap mediaInfo; // Get the mxc URL for the media. - if (!fileInfo->url().isValid() || eventId.isEmpty()) { + if (!fileInfo->url().isValid() || fileInfo->url().scheme() != QStringLiteral("mxc") || eventId.isEmpty()) { mediaInfo["source"_ls] = QUrl(); } else { QUrl source = m_room->makeMediaUrl(eventId, fileInfo->url()); - if (source.isValid() && source.scheme() == QStringLiteral("mxc")) { + if (source.isValid()) { mediaInfo["source"_ls] = source; } else { mediaInfo["source"_ls] = QUrl();