Unverified Commit 5f8ee381 authored by Axlgrep's avatar Axlgrep Committed by GitHub
Browse files

optimze the judgment logic of use_pattern in scanGenericCommand() (#9789)

in `scan 0 match ""` case,  pat is empty sds(patlen is 0), I don't think should access the
first character directly in this case(even though the first character is ' \0 '), for the
code readability, I switch the two positions of judgment logic. 
parent 992a610f
......@@ -832,7 +832,7 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) {
/* The pattern always matches if it is exactly "*", so it is
* equivalent to disabling it. */
use_pattern = !(pat[0] == '*' && patlen == 1);
use_pattern = !(patlen == 1 && pat[0] == '*');
i += 2;
} else if (!strcasecmp(c->argv[i]->ptr, "type") && o == NULL && j >= 2) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment