← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1581828 into lp:widelands

 

TiborB has proposed merging lp:~widelands-dev/widelands/bug-1581828 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1581828/+merge/297668

Please review this, see also discussion in bug report...
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1581828 into lp:widelands.
=== modified file 'src/economy/economy.cc'
--- src/economy/economy.cc	2016-04-11 06:45:29 +0000
+++ src/economy/economy.cc	2016-06-16 18:19:43 +0000
@@ -336,6 +336,7 @@
 	 Quantity   const permanent,
 	 Time       const mod_time)
 {
+	assert(owner().egbase().tribes().ware_exists(ware_type));
 	TargetQuantity & tq = ware_target_quantities_[ware_type];
 	tq.permanent = permanent;
 	tq.last_modified = mod_time;
@@ -347,6 +348,7 @@
 	 Quantity   const permanent,
 	 Time       const mod_time)
 {
+	assert(owner().egbase().tribes().worker_exists(ware_type));
 	TargetQuantity & tq = worker_target_quantities_[ware_type];
 	tq.permanent = permanent;
 	tq.last_modified = mod_time;
@@ -959,8 +961,9 @@
 		// if the target quantity of a resource is set to 0
 		// plan at least one worker, so a request for that resource is triggered
 		DescriptionIndex id_w = tribe.ware_index(bc.first);
-		if (0 == ware_target_quantity(id_w).permanent)
+		if (id_w != INVALID_INDEX && 0 == ware_target_quantity(id_w).permanent) {
 			plan_at_least_one = true;
+		}
 		idx++;
 	}
 


Follow ups