summaryrefslogtreecommitdiff
path: root/history.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'history.cpp')
-rw-r--r--history.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/history.cpp b/history.cpp
index d89d0d5..65e3a5f 100644
--- a/history.cpp
+++ b/history.cpp
@@ -61,14 +61,17 @@ Move* History::current()
/** Add a new move */
void History::add(Move* move)
{
- for (unsigned int pos = history.size(); pos > executed; --pos)
+ if (move)
{
- // Remove object created outside of History
- delete history.back();
- history.pop_back();
+ for (unsigned int pos = history.size(); pos > executed; --pos)
+ {
+ // Remove object created outside of History
+ delete history.back();
+ history.pop_back();
+ }
+ history.push_back(move);
+ ++executed;
}
- history.push_back(move);
- ++executed;
}
/** Set previous move as current */