Skip to content

Commit bd62027

Browse files
ferdymercurydpiparo
authored andcommitted
[core] fix accessing empty vector
Fixes https://root-forum.cern.ch/t/tinterpreter-crash/64364
1 parent d237b21 commit bd62027

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/metacling/src/TCling.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5484,7 +5484,7 @@ Longptr_t TCling::ExecuteMacro(const char* filename, EErrorCode* error)
54845484
const char* TCling::GetTopLevelMacroName() const
54855485
{
54865486
Warning("GetTopLevelMacroName", "Must change return type!");
5487-
return fCurExecutingMacros.back();
5487+
return fCurExecutingMacros.empty() ? nullptr : fCurExecutingMacros.back();
54885488
}
54895489

54905490
////////////////////////////////////////////////////////////////////////////////
@@ -5535,7 +5535,7 @@ const char* TCling::GetCurrentMacroName() const
55355535
Warning("GetCurrentMacroName", "Must change return type!");
55365536
#endif
55375537
#endif
5538-
return fCurExecutingMacros.back();
5538+
return fCurExecutingMacros.empty() ? nullptr : fCurExecutingMacros.back();
55395539
}
55405540

55415541
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)