Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,16 @@ class GenericObjectCreationNugget : public ObjectCreationNugget
if( m_containInsideSourceObject )
{
// The Obj has been totally made, so stuff it inside ourselves if desired.
if( sourceObj->getContain() && sourceObj->getContain()->isValidContainerFor(obj, TRUE))
// Guard against sourceObj being null or already destroyed (e.g. when this OCL fires
// from a CreateObjectDie handler -- the dying object may be in the process of being
// deleted, making the pointer dangling/invalid).
if( !sourceObj || sourceObj->isDestroyed() )
{
DEBUG_CRASH(("A OCL with ContainInsideSourceObject has a null or already-destroyed sourceObj and is killing the new object."));
// If the source object is gone, we can't contain the new object. Stillborn it.
TheGameLogic->destroyObject(obj);
}
else if( sourceObj->getContain() && sourceObj->getContain()->isValidContainerFor(obj, TRUE))
{
sourceObj->getContain()->addToContain( obj );

Expand Down
Loading