mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.4821: crash when imported autoload script was deleted
Problem: Crash when imported autoload script was deleted. Solution: Initialize local variable. (closes #10274) Give a more meaningful error message.
This commit is contained in:
@@ -6159,7 +6159,7 @@ handle_subscript(
|
||||
char_u *exp_name;
|
||||
int cc;
|
||||
int idx;
|
||||
ufunc_T *ufunc;
|
||||
ufunc_T *ufunc = NULL;
|
||||
type_T *type;
|
||||
|
||||
// Found script from "import {name} as name", script item name must
|
||||
|
@@ -1137,6 +1137,25 @@ def Test_autoload_import_relative_autoload_dir()
|
||||
delete('autoload', 'rf')
|
||||
enddef
|
||||
|
||||
def Test_autoload_import_deleted()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
export const FOO = 1
|
||||
END
|
||||
writefile(lines, 'Xa.vim')
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
import autoload './Xa.vim'
|
||||
|
||||
delete('Xa.vim')
|
||||
var x = Xa.FOO
|
||||
END
|
||||
v9.CheckScriptFailure(lines, 'E484:')
|
||||
|
||||
delete('Xdir', 'rf')
|
||||
enddef
|
||||
|
||||
func Test_import_in_diffexpr()
|
||||
CheckExecutable diff
|
||||
|
||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
4821,
|
||||
/**/
|
||||
4820,
|
||||
/**/
|
||||
|
@@ -713,7 +713,10 @@ find_exported(
|
||||
if (script->sn_import_autoload && script->sn_state == SN_STATE_NOT_LOADED)
|
||||
{
|
||||
if (do_source(script->sn_name, FALSE, DOSO_NONE, NULL) == FAIL)
|
||||
{
|
||||
semsg(_(e_cant_open_file_str), script->sn_name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Find name in "script".
|
||||
|
Reference in New Issue
Block a user