diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp
index 127a5fa46b9b959bb8f6b40dcd8f6f888ccbabe3..8d8e4b6a0297b6b6da80da39279925b23da7af40 100644
--- a/src/quick/items/qquickborderimage.cpp
+++ b/src/quick/items/qquickborderimage.cpp
@@ -562,7 +562,7 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
     // Don't implicitly create the scalegrid in the rendering thread...
     QRectF innerSourceRect(0, 0, 1, 1);
     QRectF innerTargetRect(0, 0, width(), height());
-    int borderLeft, borderTop, borderRight, borderBottom;
+    int borderLeft = 0, borderTop = 0, borderRight = 0, borderBottom = 0;
 
     bool updateNode = !oldNode;
     if (d->border) {