diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c index 3ad468fce..b88765f1d 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -485,7 +485,7 @@ gettext_putvar (const char *str, grub_size_t len, return 0; /* Enough for any number. */ - if (len == 1 && str[0] == '#') + if (len == 1 && str[0] == '#' && scope != NULL) { grub_snprintf (*ptr, 30, "%u", scope->argv.argc); *ptr += grub_strlen (*ptr);