Unified handling of empty queries with normal queries.

This commit is contained in:
antirez
2009-12-15 09:33:29 -05:00
parent 7c49733ce3
commit ed10f40b15
2 changed files with 4 additions and 6 deletions

4
sds.c
View File

@ -277,6 +277,10 @@ sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count) {
if (tokens == NULL) sdsOomAbort();
#endif
if (seplen < 1 || len < 0 || tokens == NULL) return NULL;
if (len == 0) {
*count = 0;
return tokens;
}
for (j = 0; j < (len-(seplen-1)); j++) {
/* make sure there is room for the next element and the final one */
if (slots < elements+2) {