Skip to content

Commit 59e8609

Browse files
authored
Don't use exceptions when checking for existing region (#94)
1 parent 07f3e09 commit 59e8609

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/scorepy/events.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ void region_begin(const std::string& region_name, std::string module, std::strin
3535

3636
void region_end(const std::string& region_name)
3737
{
38-
try
38+
const auto itRegion = regions.find(region_name);
39+
if (itRegion != regions.end())
3940
{
40-
auto& handle = regions.at(region_name);
41-
SCOREP_User_RegionEnd(handle.value);
41+
SCOREP_User_RegionEnd(itRegion->second.value);
4242
}
43-
catch (std::out_of_range& e)
43+
else
4444
{
4545
static region_handle error_region;
4646
static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER;

0 commit comments

Comments
 (0)