Prevent a crash in QLayout::replaceWidget
Item might be null. Change-Id: Ia432a35cb1a6bb02ee056ff8ad44a9f35bdbc146 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
c934ea341e
commit
2d1bb6d61d
@ -1133,11 +1133,15 @@ QLayoutItem* QLayout::replaceWidget(QWidget *from, QWidget *to, bool recursive)
|
||||
QLayoutItem *item = 0;
|
||||
for (int u = 0; u < count(); ++u) {
|
||||
item = itemAt(u);
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
if (item->widget() == from) {
|
||||
index = u;
|
||||
break;
|
||||
}
|
||||
if (item && item->layout() && recursive) {
|
||||
|
||||
if (item->layout() && recursive) {
|
||||
QLayoutItem *r = item->layout()->replaceWidget(from, to, true);
|
||||
if (r)
|
||||
return r;
|
||||
|
Loading…
Reference in New Issue
Block a user