diff --git a/grub-core/normal/completion.c b/grub-core/normal/completion.c index 596102848..c07100a8d 100644 --- a/grub-core/normal/completion.c +++ b/grub-core/normal/completion.c @@ -284,7 +284,8 @@ complete_file (void) /* Cut away the filename part. */ dirfile = grub_strrchr (dir, '/'); - dirfile[1] = '\0'; + if (dirfile) + dirfile[1] = '\0'; /* Iterate the directory. */ (fs->fs_dir) (dev, dir, iterate_dir, NULL);