diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c index 1a590dbc0..1c0cf6a43 100644 --- a/grub-core/loader/xnu.c +++ b/grub-core/loader/xnu.c @@ -670,6 +670,9 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile, char *name, *nameend; int namelen; + if (infoplistname == NULL) + return grub_error (GRUB_ERR_BAD_FILENAME, N_("missing p-list filename")); + name = get_name_ptr (infoplistname); nameend = grub_strchr (name, '/'); @@ -701,10 +704,7 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile, else macho = 0; - if (infoplistname) - infoplist = grub_file_open (infoplistname, GRUB_FILE_TYPE_XNU_INFO_PLIST); - else - infoplist = 0; + infoplist = grub_file_open (infoplistname, GRUB_FILE_TYPE_XNU_INFO_PLIST); grub_errno = GRUB_ERR_NONE; if (infoplist) {