Safe access to nilable error (#3)

This commit is contained in:
Steve Manuel
2022-09-04 12:26:21 -06:00
committed by GitHub

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