Safe access to nilable error

There appears to be a situation in which this err can be nil
This commit is contained in:
Benjamin Eckel
2022-09-04 12:36:27 -05:00
parent 63ff9da8dc
commit bf2509c1e7

View File

@@ -44,7 +44,7 @@ class Plugin
rc = C.extism_call(@plugin, name, input, data.bytesize)
if rc != 0 then
err = C.extism_error(@plugin)
if err.empty? then
if err&.empty? then
raise Error.new "extism_call failed"
else raise Error.new err
end