diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-10-01 20:17:59 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-10-03 13:15:47 +0200 |
commit | 26d626436b0e57493dc4d5fb3ad84a28a6c8e884 (patch) | |
tree | 98c86db2ac2dc49c10b95f55e01b9791aff52778 | |
parent | 74abe983204dab35dcce59001308c54d34ad2c02 (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>
-rw-r--r-- | examples/widgets/graphicsview/flowlayout/flowlayout.cpp | 2 |
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(); |