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
pull/228/head
Bret Curtis 8 years ago
parent 7c758a6293
commit c6805314c2

@ -21,15 +21,16 @@ namespace Fallback
} }
return it->second; return it->second;
} }
float Map::getFallbackFloat(const std::string& fall) const float Map::getFallbackFloat(const std::string& fall) const
{ {
std::string fallback=getFallbackString(fall); std::string fallback=getFallbackString(fall);
if(fallback.empty()) if(fallback.empty())
return 0; return 0;
else { else
return boost::lexical_cast<float>(fallback); return boost::lexical_cast<float>(fallback);
} }
}
int Map::getFallbackInt(const std::string& fall) const int Map::getFallbackInt(const std::string& fall) const
{ {
std::string fallback=getFallbackString(fall); std::string fallback=getFallbackString(fall);
@ -47,6 +48,7 @@ namespace Fallback
else else
return stob(fallback); return stob(fallback);
} }
osg::Vec4f Map::getFallbackColour(const std::string& fall) const osg::Vec4f Map::getFallbackColour(const std::string& fall) const
{ {
std::string sum=getFallbackString(fall); std::string sum=getFallbackString(fall);

@ -1,3 +1,5 @@
#include <stdexcept>
#include "numericeditbox.hpp" #include "numericeditbox.hpp"
namespace Gui namespace Gui
@ -36,7 +38,11 @@ namespace Gui
setCaption(MyGUI::utility::toString(mValue)); 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)); setCaption(MyGUI::utility::toString(mValue));
} }

Loading…
Cancel
Save