shell: Fix command completion logic

The original code (introduced by commit d5db35204a) looked like this
before the last rewrite/cleanup:

       if (default_module != -1) {
               return (str == NULL) ? dest : -1;
       }

However with the cleanup the logic seems to have gotten reversed.

Fixes #8501

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2018-06-22 18:50:50 +02:00 committed by Anas Nashif
commit b26ca13672

View file

@ -494,7 +494,7 @@ static struct shell_module *get_completion_module(char *str,
*/
str = strchr(str, ' ');
if (default_module) {
return str ? dest : NULL;
return str ? NULL : dest;
}
if (!str) {