← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~hjd/widelands/assert-becomes into lp:widelands

 

Hans Joachim Desserud has proposed merging lp:~hjd/widelands/assert-becomes into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~hjd/widelands/assert-becomes/+merge/226797

Fix remaining becomes() which was hidden in an assert.

Debug builds are currently failing starting with r7096. 

Does the assert fail as expected if descr() returns null or will we get a null pointer when trying to access becomes()?
-- 
https://code.launchpad.net/~hjd/widelands/assert-becomes/+merge/226797
Your team Widelands Developers is requested to review the proposed merge of lp:~hjd/widelands/assert-becomes into lp:widelands.
=== modified file 'src/logic/worker.cc'
--- src/logic/worker.cc	2014-07-15 05:08:27 +0000
+++ src/logic/worker.cc	2014-07-15 10:19:14 +0000
@@ -1337,7 +1337,7 @@
 	// This silently expects that the new worker is the same type as the old
 	// worker and can fullfill the same jobs (which should be given in all
 	// circumstances)
-	assert(becomes());
+	assert(descr().becomes());
 	const Tribe_Descr & t = descr().tribe();
 	Ware_Index const old_index = t.worker_index(descr().name());
 	Ware_Index const new_index = descr().becomes();