From 95a26edad25fe7873076f06fcb902e90dcf83aac Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Tue, 2 Mar 2021 19:51:44 -0500 Subject: [PATCH] Don't create a QImage every time --- src/notifications/ManagerMac.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/notifications/ManagerMac.cpp b/src/notifications/ManagerMac.cpp index 0819272b..1bf1577f 100644 --- a/src/notifications/ManagerMac.cpp +++ b/src/notifications/ManagerMac.cpp @@ -65,10 +65,7 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if QImage * NotificationsManager::getImgOrNullptr(const QString &path) { - auto img = new QImage{path}; - if (img->isNull()) { - delete img; + if (QFile::exists(path)) return nullptr; - } - return img; + return new QImage{path}; }