Don't create a QImage every time
This commit is contained in:
parent
716c598f4a
commit
95a26edad2
@ -65,10 +65,7 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
|
|||||||
QImage *
|
QImage *
|
||||||
NotificationsManager::getImgOrNullptr(const QString &path)
|
NotificationsManager::getImgOrNullptr(const QString &path)
|
||||||
{
|
{
|
||||||
auto img = new QImage{path};
|
if (QFile::exists(path))
|
||||||
if (img->isNull()) {
|
|
||||||
delete img;
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
return new QImage{path};
|
||||||
return img;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user