diff --git a/components/finsh/msh.c b/components/finsh/msh.c index a976705857..02cbeea196 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -358,6 +358,9 @@ void msh_auto_complete_path(char *path) struct dirent *dirent = RT_NULL; char *full_path, *ptr, *index; + if (!path) + return; + full_path = (char*)rt_malloc(256); if (full_path == RT_NULL) return; /* out of memory */