From 5c0b267734f1f62536bfb5e6646ee917a5444ca5 Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Tue, 18 Jun 2024 16:50:10 -0400 Subject: [PATCH] Check for an empty vector before popping Protect from possible seg. fault Signed-off-by: David Galiffi --- source/python/libpyomnitrace.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/python/libpyomnitrace.cpp b/source/python/libpyomnitrace.cpp index 59ab191c4..798038622 100644 --- a/source/python/libpyomnitrace.cpp +++ b/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