summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-10-01 20:17:59 +0200
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-10-03 13:15:47 +0200
commit26d626436b0e57493dc4d5fb3ad84a28a6c8e884 (patch)
tree98c86db2ac2dc49c10b95f55e01b9791aff52778 /examples/widgets
parent74abe983204dab35dcce59001308c54d34ad2c02 (diff)
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 <Friedemann.Kleint@qt.io>
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/graphicsview/flowlayout/flowlayout.cpp2
1 files changed, 1 insertions, 1 deletions
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();