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>
This commit is contained in:
Christian Ehrlicher 2019-10-01 20:17:59 +02:00
parent 74abe98320
commit 26d626436b

View File

@ -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();