fix: last is blank have bug

This commit is contained in:
Alex Duan 2023-02-27 16:23:29 +08:00
parent 64243a2127
commit 4976c80e2f
1 changed files with 6 additions and 3 deletions

View File

@ -98,7 +98,7 @@ SWords shellCommands[] = {
{"describe <all_table>", 0, 0, NULL}, {"describe <all_table>", 0, 0, NULL},
{"delete from <all_table> where ", 0, 0, NULL}, {"delete from <all_table> where ", 0, 0, NULL},
{"drop database <db_name>", 0, 0, NULL}, {"drop database <db_name>", 0, 0, NULL},
{"drop index ", 0, 0, NULL}, {"drop index <anyword>", 0, 0, NULL},
{"drop table <all_table>", 0, 0, NULL}, {"drop table <all_table>", 0, 0, NULL},
{"drop dnode <dnode_id>", 0, 0, NULL}, {"drop dnode <dnode_id>", 0, 0, NULL},
{"drop mnode on dnode <dnode_id> ;", 0, 0, NULL}, {"drop mnode on dnode <dnode_id> ;", 0, 0, NULL},
@ -577,8 +577,11 @@ void parseCommand(SWords* command, bool pattern) {
while (word->next) { while (word->next) {
word = word->next; word = word->next;
} }
word->next = addWord(p + start, i - start, pattern); int len = i - start;
command->count++; if (len > 0) {
word->next = addWord(p + start, len, pattern);
command->count++;
}
} }
start = i + 1; start = i + 1;
} else { } else {