mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Fixed CTD that could happen when removing attachments (by Realist)
o The CTD always happened in Old Attachment System (OAS) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5697 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+7
-4
@@ -7981,7 +7981,7 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
|
||||
{
|
||||
removedAttachment = *pAttachment;
|
||||
iter = (*this)[subObject]->RemoveAttachmentAtIter(iter);
|
||||
|
||||
pAttachment = NULL;
|
||||
objDeleted = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -7995,7 +7995,7 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
|
||||
{
|
||||
removedAttachment = *pAttachment;
|
||||
iter = (*this)[subObject]->RemoveAttachmentAtIter(iter);
|
||||
|
||||
pAttachment = NULL;
|
||||
objDeleted = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -8097,8 +8097,11 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
|
||||
if(pNewObj != NULL)
|
||||
*pNewObj = removedAttachment;
|
||||
|
||||
if(pAttachment->exists() && (pAttachment->usItem == 0 || pAttachment->usItem == removedAttachment.usItem ))
|
||||
*pAttachment = removedAttachment;
|
||||
|
||||
// Why is this here? By now, the object, pAttachment had been pointing to, has already been deconstructed via RemoveAttachmentAtIter.
|
||||
// (Commenting out the following two lines)
|
||||
//if(pAttachment->exists() && (pAttachment->usItem == 0 || pAttachment->usItem == removedAttachment.usItem ))
|
||||
// *pAttachment = removedAttachment;
|
||||
|
||||
if (pNewObj->exists() && Item[pNewObj->usItem].grenadelauncher )//UNDER_GLAUNCHER)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user