Author: suokko
Date: Wed Jul 30 18:09:46 2008
New Revision: 28269
URL: http://svn.gna.org/viewcvs/wesnoth?rev=28269&view=rev
Log:
Fixed segmentation fault when wml modified and killed attacker and defender in
a battle (bug hunted by Elvish_Pillager)
Modified:
trunk/changelog
trunk/src/actions.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=28269&r1=28268&r2=28269&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Wed Jul 30 18:09:46 2008
@@ -34,6 +34,8 @@
associate an id. to [time_area]s, or it won't work.
* Added some convenience macros for units: {TRANSFORM_UNIT}, etc.
* Miscellaneous and bug fixes:
+ * Fixed segmentation fault when wml modified and killed attacker and
+ defender in a battle
* Add some gcc-4.3.0 compilation fixes (patch #1083)
* Fixed bug #12094: Event "last breath" cannot be triggered for attackers
Modified: trunk/src/actions.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=28269&r1=28268&r2=28269&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Wed Jul 30 18:09:46 2008
@@ -828,6 +828,12 @@
a_ = units_.find(attacker_);
d_ = units_.find(defender_);
if(a_ == units_.end() || d_ == units_.end()) {
+ // Fix pointers to weapons
+ if (a_ != units_.end())
+
const_cast<battle_context::unit_stats*>(a_stats_)->weapon =
&a_->second.attacks()[attack_with_];
+
+ if (d_ != units_.end())
+
const_cast<battle_context::unit_stats*>(d_stats_)->weapon =
&d_->second.attacks()[defend_with_];
return;
}
*bc_ = battle_context(map_, teams_, units_, state_, attacker_,
defender_, attack_with_, defend_with_);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits