From: Max Kellermann Date: Sun, 21 Sep 2008 20:43:57 +0000 (+0200) Subject: libmpdclient: added another connection->sock check X-Git-Tag: v0.12_alpha1~201 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=54f4d47d8f0d4f7e0288a140c49b82999885e329;p=ncmpc.git libmpdclient: added another connection->sock check Check if connection->sock is valid in mpd_executeCommand(). --- diff --git a/src/libmpdclient.c b/src/libmpdclient.c index 2b4a52c..dfca0a3 100644 --- a/src/libmpdclient.c +++ b/src/libmpdclient.c @@ -451,6 +451,12 @@ static void mpd_executeCommand(mpd_Connection *connection, const char *commandPtr = command; int commandLen = strlen(command); + if (connection->sock < 0) { + strcpy(connection->errorStr, "not connected"); + connection->error = MPD_ERROR_CONNCLOSED; + return; + } + if (!connection->doneProcessing && !connection->commandList) { strcpy(connection->errorStr, "not done processing current command");