diff --git a/panelsvg.cpp b/panelsvg.cpp index d7259c671..c13607c5b 100644 --- a/panelsvg.cpp +++ b/panelsvg.cpp @@ -194,7 +194,10 @@ QString PanelSvg::prefix() void PanelSvg::resizePanel(const QSizeF& size) { - if (!size.isValid() || size.width() < 1 || size.height() < 1 || size == d->panels[d->prefix]->panelSize) { + bool sizeValid = size.width() > 0 && size.height() > 0; + if (!sizeValid || size == d->panels[d->prefix]->panelSize) { + if (!sizeValid) + kWarning() << "Invalid size" << size; return; } @@ -298,6 +301,11 @@ void PanelSvg::Private::generateBackground(PanelData *panel) if (panel->cachedBackground) { return; } + if (!panel->panelSize.isValid()) { + kWarning() << "Invalid panel size" << panel->panelSize; + panel->cachedBackground = new QPixmap(); + return; + } const int contentWidth = panel->panelSize.width() - panel->leftWidth - panel->rightWidth; const int contentHeight = panel->panelSize.height() - panel->topHeight - panel->bottomHeight;