From 1c52a202215b905c25e0eaed0f10986bcc8f9538 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 29 Jan 2017 11:49:38 +0100 Subject: [PATCH] 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 --- recipes/mpc.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/mpc.lua b/recipes/mpc.lua index 3bbdb24..6290d55 100644 --- a/recipes/mpc.lua +++ b/recipes/mpc.lua @@ -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