Changeset 11707 for code/trunk
- Timestamp:
- Jan 6, 2018, 4:34:18 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/pickup/PickupSpawner.cc
r11103 r11707 158 158 for(Pawn* pawn : ObjectList<Pawn>()) 159 159 { 160 if(spawner == nullptr) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute).161 break;162 163 160 Vector3 distance = pawn->getWorldPosition() - this->getWorldPosition(); 164 161 PickupCarrier* carrier = static_cast<PickupCarrier*>(pawn); … … 167 164 { 168 165 if(carrier->isTarget(this->pickup_)) 169 this->trigger(pawn); 166 { 167 this->trigger(pawn); // Attention: after this line, pickup_ is probably nullptr (because it was taken) and even spawner can be nullptr (if it run out of pickups)! 168 break; 169 } 170 170 } 171 171 }
Note: See TracChangeset
for help on using the changeset viewer.