Skip to content

Commit

Permalink
ubx.lua: port read/write: check for nil port
Browse files Browse the repository at this point in the history
  • Loading branch information
kmarkus committed Feb 4, 2020
1 parent 0021628 commit 82855aa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/ubx.lua.source
Original file line number Diff line number Diff line change
Expand Up @@ -1107,13 +1107,15 @@ end
--- Read from a port.
--
function M.port_read(p, rval)
assert(p, "invalid port")
if not M.is_data(rval) then
rval=M.port_alloc_read_sample(p)
end
return ubx.__port_read(p, rval), rval
end

function M.port_write(p, wval)
assert(p, "invalid port")
if M.is_data(wval) then
ubx.__port_write(p, wval)
elseif type(wval) == 'cdata' then
Expand Down

0 comments on commit 82855aa

Please sign in to comment.