>From 53c80954f2a790f8ba95a981b1e7fc911d17e952 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 17 Nov 2015 03:30:49 +0100 Subject: [PATCH] Avoid warnings when loading standard wx icons in icon_monger Really do nothing if an override for such icon is not found instead of continuing with the function execution and giving a bogus error. Also avoid throwing and immediately catching an exception which is not at all necessary when performing a map lookup. --- icon_monger.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/icon_monger.cpp b/icon_monger.cpp index 6da0872..31a3d60 100644 --- a/icon_monger.cpp +++ b/icon_monger.cpp @@ -31,7 +31,6 @@ #include "alert.hpp" #include "contains.hpp" #include "data_directory.hpp" -#include "map_lookup.hpp" #include "path_utility.hpp" // fs::path inserter #include @@ -161,14 +160,16 @@ bool is_builtin = 0 == icon_name.find("wxART_"); if(is_builtin) { - try + std::map::const_iterator const + i = icon_names_by_wx_id_.find(icon_name); + if(i == icon_names_by_wx_id_.end()) { - icon_name = map_lookup(icon_names_by_wx_id_, icon_name); - } - catch(...) - { - ; // Do nothing. Not all wxART id's have lmi overrides. + // This is not an error as not all wxART id's have lmi overrides, + // so just let the next art provider deal with it. + return wxNullBitmap; } + + icon_name = i->second; } wxSize const desired_size = desired_icon_size(client, size); -- 2.5.1