diff --git a/src/declarativeimports/core/svgitem.cpp b/src/declarativeimports/core/svgitem.cpp index 4ec6d5a06..eccff55a4 100644 --- a/src/declarativeimports/core/svgitem.cpp +++ b/src/declarativeimports/core/svgitem.cpp @@ -137,6 +137,12 @@ QSGNode *SvgItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updateP return Q_NULLPTR; } + //this is more than just an optimisation, uploading a null image to QSGAtlasTexture causes a crash + if (width() == 0 || height() == 0) { + delete oldNode; + return Q_NULLPTR; + } + SVGTextureNode *textureNode = static_cast(oldNode); if (!textureNode) { textureNode = new SVGTextureNode; @@ -152,6 +158,7 @@ QSGNode *SvgItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updateP //setContainsMultipleImages has to be done there since m_frameSvg can be shared with somebody else m_svg.data()->setContainsMultipleImages(!m_elementID.isEmpty()); const QImage image = m_svg.data()->image(QSize(width(), height()), m_elementID); + QSGTexture *texture = window()->createTextureFromImage(image, QQuickWindow::TextureCanUseAtlas); if (m_smooth) { texture->setFiltering(QSGTexture::Linear);