diff options
author | Gabriel Cruz <LTKills@users.noreply.github.com> | 2019-03-30 18:28:19 -0300 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-03-30 22:28:19 +0100 |
commit | c76494d8b745065793a604a5aefc0cb2b792b01e (patch) | |
tree | 08c7783a5255bb3f222628f812f4bf28037a93ff /src | |
parent | 2bdc7cac8be54d32c8a30cbc21639e4782a86789 (diff) | |
download | rneovim-c76494d8b745065793a604a5aefc0cb2b792b01e.tar.gz rneovim-c76494d8b745065793a604a5aefc0cb2b792b01e.tar.bz2 rneovim-c76494d8b745065793a604a5aefc0cb2b792b01e.zip |
vim-patch:8.0.0705: check did_throw before discarding exception #9808
Problem: Crash when there is an error in a timer callback. (Aron Griffis,
Ozaki Kiichi)
Solution: Check did_throw before discarding an exception. NULLify
current_exception when no longer valid.
https://github.com/vim/vim/commit/cae24be4a808d60313913cc6feea6c2bee2e2a42
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_eval.c | 7 |
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) { |