Skip to content

Commit

Permalink
Report error rather than crash on empty pop
Browse files Browse the repository at this point in the history
  • Loading branch information
dspinellis committed Jul 24, 2024
1 parent 8107768 commit 288abb2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/stab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ Block::fn_body_enter()
void
Block::exit()
{
if (scope_block.empty())
/*
* @error
* A <code>#pragma block_exit</code> was performed without
* having a corresponding active block.
*/
Error::error(E_FATAL, "#pragma block_exit on an empty block stack");
scope_block.pop_back();
current_block--;
param_clear();
Expand Down

0 comments on commit 288abb2

Please sign in to comment.