From 26d626436b0e57493dc4d5fb3ad84a28a6c8e884 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 1 Oct 2019 20:17:59 +0200 Subject: Widgets flowlayout example: Fix crash on startup The flowlayout example crashes on startup because the last change removed a c-style cast which converted -1 to ~0U ... Fixes: QTBUG-78861 Change-Id: I0dbed4472b4f68a92b3f92763d00d28baa186f9a Reviewed-by: Friedemann Kleint --- examples/widgets/graphicsview/flowlayout/flowlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/widgets/graphicsview/flowlayout/flowlayout.cpp b/examples/widgets/graphicsview/flowlayout/flowlayout.cpp index 54914b3746..03cf320568 100644 --- a/examples/widgets/graphicsview/flowlayout/flowlayout.cpp +++ b/examples/widgets/graphicsview/flowlayout/flowlayout.cpp @@ -62,7 +62,7 @@ FlowLayout::FlowLayout(QGraphicsLayoutItem *parent) : QGraphicsLayout(parent) void FlowLayout::insertItem(int index, QGraphicsLayoutItem *item) { item->setParentLayoutItem(this); - if (index > m_items.count()) + if (index > m_items.count() || index < 0) index = m_items.count(); m_items.insert(index, item); invalidate(); -- cgit v1.2.3