Skip to content

Commit

Permalink
avoid nullptr in add_effect
Browse files Browse the repository at this point in the history
  • Loading branch information
salix5 committed Nov 2, 2024
1 parent a8dde30 commit 33bc47c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,8 @@ void card::enable_field_effect(bool enabled) {
filter_disable_related_cards();
}
int32 card::add_effect(effect* peffect) {
if (!peffect)
return 0;
if (get_status(STATUS_COPYING_EFFECT) && peffect->is_flag(EFFECT_FLAG_UNCOPYABLE)) {
pduel->uncopy.insert(peffect);
return 0;
Expand Down
2 changes: 2 additions & 0 deletions field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,8 @@ void field::tag_swap(uint8 playerid) {
pduel->write_buffer32(pcard->data.code | (pcard->is_position(POS_FACEUP) ? 0x80000000 : 0));
}
void field::add_effect(effect* peffect, uint8 owner_player) {
if (!peffect)
return;
if (effects.indexer.find(peffect) != effects.indexer.end())
return;
effect_container::iterator it;
Expand Down

0 comments on commit 33bc47c

Please sign in to comment.