diff --git a/src/boot/efi/cpio.c b/src/boot/efi/cpio.c index f56db2e197f..5b90e17c41d 100644 --- a/src/boot/efi/cpio.c +++ b/src/boot/efi/cpio.c @@ -339,8 +339,11 @@ EFI_STATUS pack_cpio( if (err != EFI_SUCCESS) return log_error_status(err, "Unable to open root directory: %m"); - if (!dropin_dir) + if (!dropin_dir) { dropin_dir = rel_dropin_dir = get_extra_dir(loaded_image->FilePath); + if (!dropin_dir) + goto nothing; + } err = open_directory(root, dropin_dir, &extra_dir); if (err == EFI_NOT_FOUND) diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c index 572ea480f0e..7ef3e765446 100644 --- a/src/boot/efi/stub.c +++ b/src/boot/efi/stub.c @@ -556,8 +556,8 @@ static EFI_STATUS run(EFI_HANDLE image) { log_error_status(err, "Error loading global addons, ignoring: %m"); /* Some bootloaders always pass NULL in FilePath, so we need to check for it here. */ - if (loaded_image->FilePath) { - _cleanup_free_ char16_t *dropin_dir = get_extra_dir(loaded_image->FilePath); + _cleanup_free_ char16_t *dropin_dir = get_extra_dir(loaded_image->FilePath); + if (dropin_dir) { err = load_addons( image, loaded_image,