From 648edf3820ef77692e32952a746de8f14e36dbc3 Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Wed, 19 Jun 2024 14:59:23 -0400 Subject: [PATCH] Check for an empty vector before popping (#350) Protect from possible seg. fault Signed-off-by: David Galiffi [ROCm/rocprofiler-systems commit: 59e7b4b50195c20082ed50aeddabacf1158d85d1] --- .../rocprofiler-systems/source/python/libpyomnitrace.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/rocprofiler-systems/source/python/libpyomnitrace.cpp b/projects/rocprofiler-systems/source/python/libpyomnitrace.cpp index 59ab191c46..7980386223 100644 --- a/projects/rocprofiler-systems/source/python/libpyomnitrace.cpp +++ b/projects/rocprofiler-systems/source/python/libpyomnitrace.cpp @@ -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