EventManager: Fix a crash bug with EQUIPMENT_CHANGE event.

develop
expwnent 2015-01-15 18:13:19 -05:00
parent 2db6c0c735
commit 8f4b766107
1 changed files with 2 additions and 2 deletions

@ -763,8 +763,6 @@ static void manageEquipmentEvent(color_ostream& out) {
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
} }
if ( !hadEquipment )
delete temp;
//check for dropped items //check for dropped items
for ( auto b = v.begin(); b != v.end(); b++ ) { for ( auto b = v.begin(); b != v.end(); b++ ) {
InventoryItem i = *b; InventoryItem i = *b;
@ -777,6 +775,8 @@ static void manageEquipmentEvent(color_ostream& out) {
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
} }
if ( !hadEquipment )
delete temp;
//update equipment //update equipment
vector<InventoryItem>& equipment = equipmentLog[unit->id]; vector<InventoryItem>& equipment = equipmentLog[unit->id];