Check whether a battle has been set when calling Damage function.
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@@ -101,7 +101,10 @@ void Battling::Creature::Damage(uint32_t damage, Battling::DamageSource source)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    // HOOK: On Damage
 | 
					    // HOOK: On Damage
 | 
				
			||||||
    auto newHealth = _currentHealth - damage;
 | 
					    auto newHealth = _currentHealth - damage;
 | 
				
			||||||
    this->GetBattle()->TriggerEventListener(new DamageEvent(this, source, _currentHealth, newHealth));
 | 
					    auto battle = this->GetBattle();
 | 
				
			||||||
 | 
					    if (battle != nullptr) {
 | 
				
			||||||
 | 
					        battle->TriggerEventListener(new DamageEvent(this, source, _currentHealth, newHealth));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    _currentHealth = newHealth;
 | 
					    _currentHealth = newHealth;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (IsFainted() && damage > 0) {
 | 
					    if (IsFainted() && damage > 0) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user