aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_eval.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 7f7851f078..5b2a1c5c51 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -569,10 +569,12 @@ static void discard_exception(except_T *excp, int was_finished)
*/
void discard_current_exception(void)
{
- discard_exception(current_exception, false);
+ if (current_exception != NULL) {
+ discard_exception(current_exception, false);
+ current_exception = NULL;
+ }
// Note: all globals manipulated here should be saved/restored in
// try_enter/try_leave.
- current_exception = NULL;
need_rethrow = false;
}
@@ -1766,6 +1768,7 @@ void enter_cleanup(cleanup_T *csp)
*/
if (current_exception || need_rethrow) {
csp->exception = current_exception;
+ current_exception = NULL;
} else {
csp->exception = NULL;
if (did_emsg) {