From a176346d27849d3b823a8c3b05c651e75fd82e3c Mon Sep 17 00:00:00 2001
From: Joris <joris.dauphin@gmail.com>
Date: Mon, 21 May 2012 14:13:33 +0200
Subject: [PATCH] Fix CUnit::StoreOrder.

---
 src/unit/unit.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/unit/unit.cpp b/src/unit/unit.cpp
index 7d29b4718..dae4efb56 100644
--- a/src/unit/unit.cpp
+++ b/src/unit/unit.cpp
@@ -404,16 +404,16 @@ bool CUnit::StoreOrder(COrder *order)
 {
 	Assert(order);
 
-	if (this->SavedOrder != NULL) {
-		if (this->SavedOrder->IsValid() == false) {
-			delete this->SavedOrder;
-			this->SavedOrder = NULL;
-		}
-		return false;
-	}
 	if (order && order->Finished == true) {
 		return false;
 	}
+	if (this->SavedOrder != NULL) {
+		if (this->SavedOrder->IsValid() == true) {
+			return false;
+		}
+		delete this->SavedOrder;
+		this->SavedOrder = NULL;
+	}
 	// Save current order to come back or to continue it.
 	this->SavedOrder = order;
 	return true;