mail[Wesnoth-commits] r40069 - /trunk/src/theme.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on December 05, 2009 - 13:02:
Author: silene
Date: Sat Dec  5 13:02:02 2009
New Revision: 40069

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40069&view=rev
Log:
Fixed crash when using a nonstandard theme.

Modified:
    trunk/src/theme.cpp

Modified: trunk/src/theme.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/theme.cpp?rev=40069&r1=40068&r2=40069&view=diff
==============================================================================
--- trunk/src/theme.cpp (original)
+++ trunk/src/theme.cpp Sat Dec  5 13:02:02 2009
@@ -809,6 +809,10 @@
 
 void theme::modify_label(const std::string& id, const std::string& text)
 {
-       theme::label& label = dynamic_cast<theme::label&>(find_element(id));
-       label.set_text(text);
-}
+       theme::label *label = dynamic_cast<theme::label *>(&find_element(id));
+       if (!label) {
+               ERR_DP << "Theme contains no label called '" << id << "'.\n";
+               return;
+       }
+       label->set_text(text);
+}




Related Messages


Powered by MHonArc, Updated Sat Dec 05 13:40:07 2009