mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Don't create a QImage every time
This commit is contained in:
parent
716c598f4a
commit
95a26edad2
1 changed files with 2 additions and 5 deletions
|
@ -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};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue