diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
index 730e50a6714255037cb2b5a0846edc3944e5d1be..85bb438da5ee9a255ff4c36df86a521ff21ca2e0 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
@@ -228,7 +228,10 @@ void FormEditorItem::paintBoundingRect(QPainter *painter) const
 
     painter->setPen(pen);
 //    int offset =  m_borderWidth / 2;
-    painter->drawRect(boundingRect().adjusted(0., 0., -1., -1.));
+
+    const QRectF br = boundingRect();
+    if (br.isValid())
+        painter->drawRect(br.adjusted(0., 0., -1., -1.));
 }
 
 void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)