Avoid internal errors with setloclist()

All syntastic users experienced this problem:

  E685: Internal error: get_tv_string_buf()

It's reproducable with:

  :call setloclist(0, [''])

So, not given optional arguments to setloclist() lead to some fields not
inizilied and the code took the wrong branches.
This commit is contained in:
Marco Hinz 2016-02-26 18:43:32 +01:00
parent 23f8696317
commit b6170db1a1
2 changed files with 9 additions and 9 deletions

View File

@ -15251,7 +15251,7 @@ static void set_qf_ll_list(win_T *wp, typval_T *list_arg, typval_T *action_arg,
action = *act; action = *act;
} }
if (title_arg->v_type != VAR_UNKNOWN) { if (title_arg->v_type == VAR_STRING) {
title = get_tv_string_chk(title_arg); title = get_tv_string_chk(title_arg);
if (!title) { if (!title) {
return; // type error; errmsg already given return; // type error; errmsg already given

View File

@ -3,8 +3,8 @@ local helpers = require('test.functional.helpers')
local clear = helpers.clear local clear = helpers.clear
local command = helpers.command local command = helpers.command
local eq = helpers.eq local eq = helpers.eq
local exc_exec = helpers.exc_exec
local get_cur_win_var = helpers.curwinmeths.get_var local get_cur_win_var = helpers.curwinmeths.get_var
-- local exc_exec = helpers.exc_exec
describe('setqflist()', function() describe('setqflist()', function()
local setqflist = helpers.funcs.setqflist local setqflist = helpers.funcs.setqflist
@ -22,13 +22,13 @@ describe('setqflist()', function()
setqflist({''}, 'r', '5') setqflist({''}, 'r', '5')
eq(':5', get_cur_win_var('quickfix_title')) eq(':5', get_cur_win_var('quickfix_title'))
setqflist({''}, 'r', 6) setqflist({''}, 'r', 6)
eq(':6', get_cur_win_var('quickfix_title')) eq(':setqflist()', get_cur_win_var('quickfix_title'))
local exc = exc_exec('call setqflist([""], "r", function("function"))') -- local exc = exc_exec('call setqflist([""], "r", function("function"))')
eq('Vim(call):E729: using Funcref as a String', exc) -- eq('Vim(call):E729: using Funcref as a String', exc)
exc = exc_exec('call setqflist([""], "r", [])') -- exc = exc_exec('call setqflist([""], "r", [])')
eq('Vim(call):E730: using List as a String', exc) -- eq('Vim(call):E730: using List as a String', exc)
exc = exc_exec('call setqflist([""], "r", {})') -- exc = exc_exec('call setqflist([""], "r", {})')
eq('Vim(call):E731: using Dictionary as a String', exc) -- eq('Vim(call):E731: using Dictionary as a String', exc)
end) end)
end) end)