← Back to team overview

widelands-dev team mailing list archive

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

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1530723 into lp:widelands.

Commit message:
WordWrap no longer checks the safety margin for empty text. This fixes a crash in the Game Results screen.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1530723 in widelands: "worldwrap - game crash"
  https://bugs.launchpad.net/widelands/+bug/1530723

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

The game results screen for Collectors should no longer crash with an assert error.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1530723 into lp:widelands.
=== modified file 'src/graphic/wordwrap.cc'
--- src/graphic/wordwrap.cc	2015-12-13 18:35:45 +0000
+++ src/graphic/wordwrap.cc	2016-01-23 10:28:07 +0000
@@ -148,7 +148,7 @@
 	 uint32_t safety_margin)
 {
 	std::string::size_type minimum_chars = 1; // So we won't get empty lines
-	assert(m_wrapwidth > safety_margin);
+	assert(text.empty() || m_wrapwidth > safety_margin);
 
 	std::string::size_type orig_end = text.find('\n', line_start);
 	if (orig_end == std::string::npos)


Follow ups