forked from mirror/openmw-tes3mp
Avoid Ogre exceptions and null pointers.
This commit is contained in:
parent
39cd89a9af
commit
2f26fc1188
1 changed files with 11 additions and 5 deletions
|
@ -170,12 +170,15 @@ namespace CSVWorld
|
|||
mSelectedEntities.find(result.first);
|
||||
if(iter != mSelectedEntities.end()) // currently selected
|
||||
{
|
||||
std::vector<std::string> deletedEntities = mSelectedEntities[result.first];
|
||||
while(!deletedEntities.empty())
|
||||
std::vector<std::string> clonedEntities = mSelectedEntities[result.first];
|
||||
while(!clonedEntities.empty())
|
||||
{
|
||||
scene->detachObject(deletedEntities.back());
|
||||
mSceneMgr->destroyEntity(deletedEntities.back());
|
||||
deletedEntities.pop_back();
|
||||
if(mSceneMgr->hasEntity(clonedEntities.back()))
|
||||
{
|
||||
scene->detachObject(clonedEntities.back());
|
||||
mSceneMgr->destroyEntity(clonedEntities.back());
|
||||
}
|
||||
clonedEntities.pop_back();
|
||||
}
|
||||
mSelectedEntities.erase(iter);
|
||||
|
||||
|
@ -189,6 +192,9 @@ namespace CSVWorld
|
|||
while(iter.hasMoreElements())
|
||||
{
|
||||
Ogre::MovableObject * element = iter.getNext();
|
||||
if(!element)
|
||||
break;
|
||||
|
||||
if(element->getMovableType() != "Entity")
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in a new issue