Prevent null-pointer deference during vim_eval #785

If the eval_expr call in vim_eval returns NULL, a null-pointer deference
would happen a few frames down, in vim_to_object_rec
This commit is contained in:
Andrew Chin
2014-05-30 15:42:32 -04:00
committed by Justin M. Keyes
parent d2dfa8523e
commit 785b16d905

View File

@@ -61,6 +61,10 @@ Object vim_eval(String str, Error *err)
try_start();
typval_T *expr_result = eval_expr((char_u *) str.data, NULL);
if (!expr_result) {
set_api_error("Failed to eval expression", err);
}
if (!try_end(err)) {
// No errors, convert the result
rv = vim_to_object(expr_result);