← Back to team overview

widelands-dev team mailing list archive

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

 

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

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1603763 in widelands: "crash on Geologist find resource: Widelands::kNoResource' failed"
  https://bugs.launchpad.net/widelands/+bug/1603763

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

I think this can be investigated bit more deeply, but this fix is good as well, and safe....

The bottom line is that recalc_default_resources now make sure that calculated resource is not INVALID_RESOURCE - then it calls clear_resources() instead of setting this value as a resource. Only kNoResource is allowed in such situation.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1603763 into lp:widelands.
=== modified file 'src/logic/map.cc'
--- src/logic/map.cc	2016-05-07 18:54:04 +0000
+++ src/logic/map.cc	2016-07-17 19:41:55 +0000
@@ -249,7 +249,7 @@
 			}
 			amount /= 6;
 
-			if (res == -1 || !amount) {
+			if (res == -1 || res == INVALID_INDEX || res == Widelands::kNoResource || !amount) {
 				clear_resources(f);
 			} else {
 				initialize_resources(f, res, amount);


Follow ups