diff options
-rw-r--r-- | src/statuseffect.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 7ec1af182..620ed7f29 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -118,14 +118,20 @@ int StatusEffect::blockEffectIndexToEffectIndex(const int blockIndex) StatusEffect *StatusEffect::getStatusEffect(const int index, const bool enabling) { - // +++ need check - return statusEffects[enabling][index]; + std::map<int, StatusEffect *> &effects = statusEffects[enabling]; + const std::map<int, StatusEffect *>::iterator it = effects.find(index); + if (it != effects.end()) + return (*it).second; + return nullptr; } StatusEffect *StatusEffect::getStunEffect(const int index, const bool enabling) { - // +++ need check - return stunEffects[enabling][index]; + std::map<int, StatusEffect *> &effects = stunEffects[enabling]; + const std::map<int, StatusEffect *>::iterator it = effects.find(index); + if (it != effects.end()) + return (*it).second; + return nullptr; } void StatusEffect::load() |