improve error checking
This commit is contained in:
1 file changed
+4
-2
@@ -58,7 +58,7 @@ end
|
|||||||
--
|
--
|
||||||
local function create_new_scratch_buffer(new_window, buffer_name)
|
local function create_new_scratch_buffer(new_window, buffer_name)
|
||||||
-- Check if the buffer name is set
|
-- Check if the buffer name is set
|
||||||
if not buffer_name or type(buffer_name) ~= "string" then
|
if not buffer_name or type(buffer_name) ~= "string" or string.len(buffer_name) == 0 then
|
||||||
error("Buffer name not set or invalid in create_new_scratch_buffer")
|
error("Buffer name not set or invalid in create_new_scratch_buffer")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -151,7 +151,9 @@ function M.setup(opts)
|
|||||||
|
|
||||||
-- Check for configuration overrides passed in via opts
|
-- Check for configuration overrides passed in via opts
|
||||||
if opts ~= nil and type(opts) == "table" then
|
if opts ~= nil and type(opts) == "table" then
|
||||||
if opts.buffer_name and type(opts.buffer_name) ~= "string" then
|
if
|
||||||
|
opts.buffer_name and (type(opts.buffer_name) ~= "string" or string.len(opts.buffer_name) == 0)
|
||||||
|
then
|
||||||
error("Invalid buffer name provided in setup options")
|
error("Invalid buffer name provided in setup options")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user