FrameSvg: prevent crash when calling mask() with no frame yet created

Reviewers: #plasma, apol

Reviewed By: apol

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D21200
This commit is contained in:
Friedrich W. H. Kossebau 2019-05-13 23:51:24 +02:00
parent 084ba0f886
commit 193775def6

View File

@ -298,10 +298,14 @@ QPixmap FrameSvg::alphaMask() const
QRegion FrameSvg::mask() const QRegion FrameSvg::mask() const
{ {
QRegion result;
if (!d->frame) {
return result;
}
QString id = d->cacheId(d->frame.data(), QString()); QString id = d->cacheId(d->frame.data(), QString());
QRegion* obj = d->frame->cachedMasks.object(id); QRegion* obj = d->frame->cachedMasks.object(id);
QRegion result;
if (!obj) { if (!obj) {
obj = new QRegion(QBitmap(d->alphaMask().mask())); obj = new QRegion(QBitmap(d->alphaMask().mask()));