diff options
author | Loren Burkholder <computersemiexpert@outlook.com> | 2021-03-02 19:51:44 -0500 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-03-17 19:18:07 +0100 |
commit | 95a26edad25fe7873076f06fcb902e90dcf83aac (patch) | |
tree | b985dae2e22770d1a807fe4b9ed16d4c7928efd9 /src/notifications/ManagerMac.cpp | |
parent | Simplify macOS checks for a null image (diff) | |
download | nheko-95a26edad25fe7873076f06fcb902e90dcf83aac.tar.xz |
Don't create a QImage every time
Diffstat (limited to 'src/notifications/ManagerMac.cpp')
-rw-r--r-- | src/notifications/ManagerMac.cpp | 7 |
1 files 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}; } |