Fix crash when no instances are available

This commit is contained in:
Jan Dalheimer 2013-11-27 15:41:36 +01:00 committed by Petr Mrázek
parent 8831856172
commit 8334b6a09f

View File

@ -364,6 +364,11 @@ int InstanceList::add(InstancePtr t)
InstancePtr InstanceList::getInstanceById(QString instId) const InstancePtr InstanceList::getInstanceById(QString instId) const
{ {
if (m_instances.isEmpty())
{
return InstancePtr();
}
QListIterator<InstancePtr> iter(m_instances); QListIterator<InstancePtr> iter(m_instances);
InstancePtr inst; InstancePtr inst;
while (iter.hasNext()) while (iter.hasNext())