From c6805314c22a1837c03faeb2e3a045936ad1b776 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sun, 11 Jun 2017 09:32:30 +0200 Subject: [PATCH] be explicit about what we are trying to catch instead of catching everything and fixed up formatting use Allman style brackets not K&R style, additional formatting for fallback.cpp which needed some love revert allman formatting changes --- components/fallback/fallback.cpp | 8 +++++--- components/widgets/numericeditbox.cpp | 8 +++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/components/fallback/fallback.cpp b/components/fallback/fallback.cpp index 010e1025c..11a577a45 100644 --- a/components/fallback/fallback.cpp +++ b/components/fallback/fallback.cpp @@ -21,15 +21,16 @@ namespace Fallback } return it->second; } + float Map::getFallbackFloat(const std::string& fall) const { std::string fallback=getFallbackString(fall); if(fallback.empty()) return 0; - else { - return boost::lexical_cast(fallback); - } + else + return boost::lexical_cast(fallback); } + int Map::getFallbackInt(const std::string& fall) const { std::string fallback=getFallbackString(fall); @@ -47,6 +48,7 @@ namespace Fallback else return stob(fallback); } + osg::Vec4f Map::getFallbackColour(const std::string& fall) const { std::string sum=getFallbackString(fall); diff --git a/components/widgets/numericeditbox.cpp b/components/widgets/numericeditbox.cpp index d59deb378..828a84589 100644 --- a/components/widgets/numericeditbox.cpp +++ b/components/widgets/numericeditbox.cpp @@ -1,3 +1,5 @@ +#include + #include "numericeditbox.hpp" namespace Gui @@ -36,7 +38,11 @@ namespace Gui setCaption(MyGUI::utility::toString(mValue)); } } - catch (...) + catch (std::invalid_argument) + { + setCaption(MyGUI::utility::toString(mValue)); + } + catch (std::out_of_range) { setCaption(MyGUI::utility::toString(mValue)); }