diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-03-31 16:15:09 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-03-31 16:15:09 +0000 |
commit | f641d046fa8053a715fdfe70b570156ac4b6a953 (patch) | |
tree | e5eda0934be474e9de74ba1e5eafe384ebcc063d /src/interface.c | |
parent | 9e382536dc74476e91966442a639cf437b2c22c0 (diff) | |
download | mpd-f641d046fa8053a715fdfe70b570156ac4b6a953.tar.gz mpd-f641d046fa8053a715fdfe70b570156ac4b6a953.tar.xz mpd-f641d046fa8053a715fdfe70b570156ac4b6a953.zip |
cleanup reading from interface, when argArrayLength returned by buffer2array
is 0, we weren't dealing with this well at all!
git-svn-id: https://svn.musicpd.org/mpd/trunk@559 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/interface.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/interface.c b/src/interface.c index b1f016bc3..2ef2fafe6 100644 --- a/src/interface.c +++ b/src/interface.c @@ -229,7 +229,8 @@ int interfaceReadInput(Interface * interface) { argArrayLength = buffer2array(interface->buffer,&argArray); if(interface->commandList) { - if(strcmp(argArray[0],INTERFACE_LIST_MODE_END)==0) { + if(argArrayLength==0); + else if(strcmp(argArray[0],INTERFACE_LIST_MODE_END)==0) { ListNode * node = interface->commandList->firstNode; ret = 0; @@ -273,14 +274,21 @@ int interfaceReadInput(Interface * interface) { } } else { - if(strcmp(argArray[0],INTERFACE_LIST_MODE_BEGIN)==0) { + if(argArrayLength && + strcmp(argArray[0], + INTERFACE_LIST_MODE_BEGIN)==0) + { interface->commandList = makeList(free); interface->commandListSize = sizeof(List); ret = 1; } else { - if(strcmp(argArray[0],INTERFACE_LIST_MODE_END)==0) { + if(argArrayLength==0) ret = 0; + else if(strcmp(argArray[0], + INTERFACE_LIST_MODE_END) + ==0) + { myfprintf(interface->fp,"%s not in command list mode\n",COMMAND_RESPOND_ERROR); ret = -1; } |