From c4fc32e06eaa724fc0780ce44ae5b1f0de2f2863 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Mon, 14 Apr 2014 22:20:44 -0400 Subject: [PATCH] Don't use exceptions for normal control flow --- osx/tools/graphtool.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osx/tools/graphtool.cpp b/osx/tools/graphtool.cpp index a9c5669d..b451540a 100644 --- a/osx/tools/graphtool.cpp +++ b/osx/tools/graphtool.cpp @@ -13,6 +13,7 @@ #include #include #include +#include using boost::math::constants::pi; cursor_type arrow_curs[3][3] = { @@ -1002,13 +1003,12 @@ void undo_clip(sf::RenderTarget& where) { } void setActiveRenderTarget(sf::RenderTarget& where) { - try { + const std::type_info& type = typeid(where); + if(type == typeid(sf::RenderWindow&)) dynamic_cast(where).setActive(); - } catch(std::bad_cast) { - try { - dynamic_cast(where).setActive(); - } catch(std::bad_cast) {} - } + else if(type == typeid(sf::RenderTexture&)) + dynamic_cast(where).setActive(); + else throw std::bad_cast(); } Region& Region::operator-=(Region& other) {