From 0868827c9fa08b7e06db71c1900f138c7c0f8e1c Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Tue, 28 Oct 2025 20:49:55 +0100 Subject: [PATCH] [core] fix accessing empty vector Fixes https://root-forum.cern.ch/t/tinterpreter-crash/64364 --- core/metacling/src/TCling.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/metacling/src/TCling.cxx b/core/metacling/src/TCling.cxx index c52794664083c..62efdcca03a7c 100644 --- a/core/metacling/src/TCling.cxx +++ b/core/metacling/src/TCling.cxx @@ -5484,7 +5484,7 @@ Longptr_t TCling::ExecuteMacro(const char* filename, EErrorCode* error) const char* TCling::GetTopLevelMacroName() const { Warning("GetTopLevelMacroName", "Must change return type!"); - return fCurExecutingMacros.back(); + return fCurExecutingMacros.empty() ? nullptr : fCurExecutingMacros.back(); } //////////////////////////////////////////////////////////////////////////////// @@ -5535,7 +5535,7 @@ const char* TCling::GetCurrentMacroName() const Warning("GetCurrentMacroName", "Must change return type!"); #endif #endif - return fCurExecutingMacros.back(); + return fCurExecutingMacros.empty() ? nullptr : fCurExecutingMacros.back(); } ////////////////////////////////////////////////////////////////////////////////