mpc.lua: Fix "connection closed"-detection
Thanks to SammysHP for reporting this on IRC. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
dfc23755e3
commit
a0898fc6b7
|
@ -76,9 +76,9 @@ function mpc:_connect()
|
||||||
self._input:read_line_async(GLib.PRIORITY_DEFAULT, nil, function(obj, res)
|
self._input:read_line_async(GLib.PRIORITY_DEFAULT, nil, function(obj, res)
|
||||||
local line, err = obj:read_line_finish(res)
|
local line, err = obj:read_line_finish(res)
|
||||||
-- Ugly API. On success we get string, length-of-string
|
-- Ugly API. On success we get string, length-of-string
|
||||||
-- and on error we get nil, error
|
-- and on error we get nil, error. Other versions of lgi
|
||||||
--if tostring(line) == "" and err == 1 then
|
-- behave differently.
|
||||||
if tostring(line) == "" then
|
if line == nil or tostring(line) == "" then
|
||||||
err = "Connection closed"
|
err = "Connection closed"
|
||||||
end
|
end
|
||||||
if type(err) ~= "number" then
|
if type(err) ~= "number" then
|
||||||
|
|
Loading…
Reference in New Issue