bugfix: there may be a NULL object add to layout and cause crash

Change-Id: Ife4df44296aecf4153b78d07f132c6c553b7c735
This commit is contained in:
杨万青 2015-08-26 14:42:44 +08:00
parent dc950f9a36
commit b10111dffd
Notes: Deepin Code Review 2016-06-14 07:19:47 +00:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: Hualet Wang <mr.asianwang@gmail.com>
Submitted-by: Hualet Wang <mr.asianwang@gmail.com>
Submitted-at: Wed, 26 Aug 2015 15:36:57 +0800
Reviewed-on: https://cr.deepin.io/6593
Project: dde/dde-dock
Branch: refs/heads/master

View File

@ -9,6 +9,9 @@ DockLayout::DockLayout(QWidget *parent) :
void DockLayout::addItem(AbstractDockItem *item)
{
if (!item)
return;
if (m_lastHoverIndex == -1)
insertItem(item,m_appList.count());
else
@ -17,6 +20,9 @@ void DockLayout::addItem(AbstractDockItem *item)
void DockLayout::insertItem(AbstractDockItem *item, int index)
{
if (!item)
return;
item->setParent(this);
item->show();
int appCount = m_appList.count();