Author: mordante
Date: Wed Mar 26 17:56:17 2008
New Revision: 25158
URL: http://svn.gna.org/viewcvs/wesnoth?rev=25158&view=rev
Log:
Don't render empty strings on the canvas.
Modified:
trunk/src/gui/widgets/canvas.cpp
Modified: trunk/src/gui/widgets/canvas.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/canvas.cpp?rev=25158&r1=25157&r2=25158&view=diff
==============================================================================
--- trunk/src/gui/widgets/canvas.cpp (original)
+++ trunk/src/gui/widgets/canvas.cpp Wed Mar 26 17:56:17 2008
@@ -684,8 +684,14 @@
text_ =
t_string(game_logic::formula(text_formula_).execute(variables).as_string());
}
+ if(text_.empty()) {
+ DBG_G_D << "Text: no text to render, leave.\n";
+ return;
+ }
+
SDL_Color col = { (colour_ >> 24), (colour_ >> 16), (colour_ >> 8),
colour_ };
surface surf(font::get_rendered_text(text_, font_size_, col,
TTF_STYLE_NORMAL));
+ assert(surf);
game_logic::map_formula_callable local_variables(variables);
local_variables.add("text_width", variant(surf->w));
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits