mpc.lua: Call reply handler at a later point

This calls a quite arbitrary callback which could cause an error. Thus,
only call it when everything else is done.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-01-29 11:49:38 +01:00
parent a0898fc6b7
commit 1c52a20221
1 changed files with 2 additions and 1 deletions

View File

@ -95,9 +95,10 @@ function mpc:_connect()
else
arg = { line }
end
self._reply_handlers[1](success, arg)
local handler = self._reply_handlers[1]
table.remove(self._reply_handlers, 1)
self._pending_reply = {}
handler(success, arg)
else
local _, _, key, value = string.find(line, "([^:]+):%s(.+)")
if key then