[-] Fixed crash when autocasting spells without sound

This commit is contained in:
cybermind 2014-06-04 00:08:16 +06:00
parent 1bfbd56f92
commit 12e52ab172

View file

@ -529,10 +529,12 @@ int SpellCast(CUnit &caster, const SpellType &spell, CUnit *target, const Vec2i
//
// Ugly hack, CastAdjustVitals makes it's own mana calculation.
//
if (spell.Target == TargetSelf) {
PlayUnitSound(caster, spell.SoundWhenCast.Sound);
} else {
PlayGameSound(spell.SoundWhenCast.Sound, CalculateVolume(false, ViewPointDistance(goalPos), spell.SoundWhenCast.Sound->Range));
if (spell.SoundWhenCast.Sound) {
if (spell.Target == TargetSelf) {
PlayUnitSound(caster, spell.SoundWhenCast.Sound);
} else {
PlayGameSound(spell.SoundWhenCast.Sound, CalculateVolume(false, ViewPointDistance(goalPos), spell.SoundWhenCast.Sound->Range));
}
}
for (std::vector<SpellActionType *>::const_iterator act = spell.Action.begin();
act != spell.Action.end(); ++act) {