Skip to content

Commit 1587ba0

Browse files
committed
fix: handle null pointer in to_string util
1 parent 2210bc4 commit 1587ba0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

evdev/util.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ end
4848
---@param str_ptr ffi.cdata* pointer to string
4949
---@return string
5050
function mod.to_string(str_ptr)
51-
return str_ptr and ffi.string(str_ptr) or ""
51+
if str_ptr == nil then
52+
return ""
53+
end
54+
55+
return ffi.string(str_ptr)
5256
end
5357

5458
---@param pathname string

0 commit comments

Comments
 (0)