Author: shadowmaster
Date: Wed Jun  8 01:55:59 2011
New Revision: 49789

URL: http://svn.gna.org/viewcvs/wesnoth?rev=49789&view=rev
Log:
Fix unhandled utils::invalid_utf8_exception when displaying tooltips

Handle the exception and don't display the tooltip, logging an error in
the display domain instead.

Modified:
    branches/1.8/changelog
    branches/1.8/src/tooltips.cpp

Modified: branches/1.8/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.8/changelog?rev=49789&r1=49788&r2=49789&view=diff
==============================================================================
--- branches/1.8/changelog (original)
+++ branches/1.8/changelog Wed Jun  8 01:55:59 2011
@@ -4,6 +4,7 @@
  * User interface:
    * Fix starting location labels being initially invisible in the map editor
      (bug #17956).
+   * Fix unhandled utils::invalid_utf8_exception when displaying tooltips
 
 Version 1.8.6:
  * Campaigns:

Modified: branches/1.8/src/tooltips.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.8/src/tooltips.cpp?rev=49789&r1=49788&r2=49789&view=diff
==============================================================================
--- branches/1.8/src/tooltips.cpp (original)
+++ branches/1.8/src/tooltips.cpp Wed Jun  8 01:55:59 2011
@@ -15,11 +15,14 @@
 #include "global.hpp"
 
 #include "font.hpp"
+#include "log.hpp"
 #include "marked-up_text.hpp"
+#include "serialization/string_utils.hpp"
 #include "tooltips.hpp"
 #include "video.hpp"
 
-
+static lg::log_domain log_display("display");
+#define ERR_DP LOG_STREAM(err, log_display)
 
 namespace {
 
@@ -154,7 +157,11 @@
                if(mousex > i->rect.x && mousey > i->rect.y &&
                   mousex < i->rect.x + i->rect.w && mousey < i->rect.y + 
i->rect.h) {
                        if(current_tooltip != i) {
-                               show_tooltip(*i);
+                               try {
+                                       show_tooltip(*i);
+                               } catch(const utils::invalid_utf8_exception&) {
+                                       ERR_DP << "tooltip contains invalid 
UTF-8\n";
+                               }
                                current_tooltip = i;
                        }
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to