summaryrefslogtreecommitdiff
path: root/script/plugins/ffi
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-06-13 17:48:35 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-06-13 17:48:35 +0800
commit073aa8bf19938b370da4a22940dfa09c7453607a (patch)
treef8cff757126ed145dae2b39e1c6e90a022a2f008 /script/plugins/ffi
parente67c6b21a18d770a747ddd9712e53674c1f52044 (diff)
downloadlua-language-server-073aa8bf19938b370da4a22940dfa09c7453607a.zip
check nil
Diffstat (limited to 'script/plugins/ffi')
-rw-r--r--script/plugins/ffi/c-parser/ctypes.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/script/plugins/ffi/c-parser/ctypes.lua b/script/plugins/ffi/c-parser/ctypes.lua
index 81d0ccf6..115f78ab 100644
--- a/script/plugins/ffi/c-parser/ctypes.lua
+++ b/script/plugins/ffi/c-parser/ctypes.lua
@@ -149,7 +149,10 @@ end
local function add_to_fields(lst, field_src, fields)
if type(field_src) == "table" and not field_src.ids then
assert(field_src.type.type == "union")
- local subfields = get_fields(lst, field_src.type.fields)
+ local subfields, err = get_fields(lst, field_src.type.fields)
+ if not subfields then
+ return nil, err
+ end
for _, subfield in ipairs(subfields) do
table.insert(fields, subfield)
end