Skip to content

Commit 93a23bc

Browse files
committed
windows.rb: can call win32api using nil as NULL for pointer argument
Exception occurred when interrupted with Ctrl+C on legacy conhost
1 parent 235367d commit 93a23bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/reline/io/windows.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def initialize(dllname, func, import, export = "0", calltype = :stdcall)
115115
def call(*args)
116116
import = @proto.split("")
117117
args.each_with_index do |x, i|
118-
args[i], = [x == 0 ? nil : +x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
118+
args[i], = [x == 0 ? nil : x&.+@].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
119119
args[i], = [x].pack("I").unpack("i") if import[i] == "I"
120120
end
121121
ret, = @func.call(*args)

0 commit comments

Comments
 (0)