Fix crash after sending image caused by the recent refactor

This commit is contained in:
Nicolas Werner 2021-12-30 02:10:33 +01:00
parent b847623fbe
commit 203ddb20de
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -712,7 +712,7 @@ InputBar::showPreview(const QMimeData &source, const QString &path, const QStrin
QSize dimensions; QSize dimensions;
QString blurhash; QString blurhash;
auto mimeClass = mime.splitRef(u'/')[0]; auto mimeClass = mime.left(mime.indexOf(u'/'));
nhlog::ui()->debug("Mime: {}", mime.toStdString()); nhlog::ui()->debug("Mime: {}", mime.toStdString());
if (mimeClass == u"image") { if (mimeClass == u"image") {
QImage img = utils::readImage(data); QImage img = utils::readImage(data);
@ -760,11 +760,11 @@ InputBar::showPreview(const QMimeData &source, const QString &path, const QStrin
if (encryptedFile) if (encryptedFile)
encryptedFile->url = res.content_uri; encryptedFile->url = res.content_uri;
if (mimeClass == "image") if (mimeClass == u"image")
image(filename, encryptedFile, url, mime, size, dimensions, blurhash); image(filename, encryptedFile, url, mime, size, dimensions, blurhash);
else if (mimeClass == "audio") else if (mimeClass == u"audio")
audio(filename, encryptedFile, url, mime, size); audio(filename, encryptedFile, url, mime, size);
else if (mimeClass == "video") else if (mimeClass == u"video")
video(filename, encryptedFile, url, mime, size); video(filename, encryptedFile, url, mime, size);
else else
file(filename, encryptedFile, url, mime, size); file(filename, encryptedFile, url, mime, size);