Code

libmpdclient: added another connection->sock check
authorMax Kellermann <max@duempel.org>
Sun, 21 Sep 2008 20:43:57 +0000 (22:43 +0200)
committerMax Kellermann <max@duempel.org>
Sun, 21 Sep 2008 20:43:57 +0000 (22:43 +0200)
Check if connection->sock is valid in mpd_executeCommand().

src/libmpdclient.c

index 2b4a52c85458a348826a3f6743cf9714cd6cdf6d..dfca0a347a0ae5b0de341f3ba214580427b056fe 100644 (file)
@@ -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");