Skip to content

Commit

Permalink
Check for an empty vector before popping (#350)
Browse files Browse the repository at this point in the history
Protect from possible seg. fault

Signed-off-by: David Galiffi <[email protected]>
  • Loading branch information
dgaliffiAMD authored Jun 19, 2024
1 parent f9ae806 commit 59e7b4b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/python/libpyomnitrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,11 @@ profiler_function(py::object pframe, const char* swhat, py::object arg)

// stop function
auto _profiler_return = [&]() {
_config.records.back()();
_config.records.pop_back();
if(!_config.records.empty())
{
_config.records.back()();
_config.records.pop_back();
}
};

// process what
Expand Down

0 comments on commit 59e7b4b

Please sign in to comment.