diff options
-rw-r--r-- | nixos/modules/system/boot/loader/grub/install-grub.pl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl index b788e427dff..9af799184b6 100644 --- a/nixos/modules/system/boot/loader/grub/install-grub.pl +++ b/nixos/modules/system/boot/loader/grub/install-grub.pl @@ -638,8 +638,11 @@ sub readGrubState { # guaranteed to be present. $jsonStateLine = defined $jsonStateLine ? $jsonStateLine : '{}'; # empty JSON object chomp($jsonStateLine); + if ($jsonStateLine eq "") { + $jsonStateLine = '{}'; # empty JSON object + } my %jsonState = %{decode_json($jsonStateLine)}; - my @extraGrubInstallArgs = @{$jsonState{'extraGrubInstallArgs'}}; + my @extraGrubInstallArgs = exists($jsonState{'extraGrubInstallArgs'}) ? @{$jsonState{'extraGrubInstallArgs'}} : (); close FILE; my $grubState = GrubState->new(name => $name, version => $version, efi => $efi, devices => $devices, efiMountPoint => $efiMountPoint, extraGrubInstallArgs => \@extraGrubInstallArgs ); return $grubState |