Author: ilor
Date: Mon Sep 22 22:29:23 2008
New Revision: 29651

URL: http://svn.gna.org/viewcvs/wesnoth?rev=29651&view=rev
Log:
editor2: ignore null actions in an action_chain

Modified:
    trunk/src/editor2/action.cpp

Modified: trunk/src/editor2/action.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/action.cpp?rev=29651&r1=29650&r2=29651&view=diff
==============================================================================
--- trunk/src/editor2/action.cpp (original)
+++ trunk/src/editor2/action.cpp Mon Sep 22 22:29:23 2008
@@ -79,7 +79,9 @@
 int editor_action_chain::action_count() const {
        int count = 0;
        foreach (const editor_action* a, actions_) {
-               count += a->action_count();
+               if (a) {
+                       count += a->action_count();
+               }
        }
        return count;
 }
@@ -107,7 +109,9 @@
 editor_action_chain* editor_action_chain::perform(map_context& mc) const {
        std::auto_ptr<editor_action_chain> undo(new editor_action_chain());
        foreach (editor_action* a, actions_) {
-               undo->append_action(a->perform(mc));
+               if (a != NULL) {
+                       undo->append_action(a->perform(mc));
+               }
        }
        std::reverse(undo->actions_.begin(), undo->actions_.end());
        return undo.release();
@@ -115,7 +119,9 @@
 void editor_action_chain::perform_without_undo(map_context& mc) const
 {
     foreach (editor_action* a, actions_) {
-               a->perform_without_undo(mc);
+               if (a != NULL) {
+                       a->perform_without_undo(mc);
+               }
        }
 }
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to