From c3dd31f177b532e7e94b74afca7241778c23af6f Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 2 Jun 2019 09:03:41 +0200 Subject: [PATCH] maintainers/scripts/update.nix: handle null paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously we did not handle non-existant paths making the program crash. Let’s show a proper error. --- maintainers/scripts/update.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/maintainers/scripts/update.nix b/maintainers/scripts/update.nix index 2d1f152ed770..b980514cc094 100755 --- a/maintainers/scripts/update.nix +++ b/maintainers/scripts/update.nix @@ -69,9 +69,12 @@ let let attrSet = pkgs.lib.attrByPath (pkgs.lib.splitString "." path) null pkgs; in - packagesWith (name: pkg: builtins.hasAttr "updateScript" pkg) - (name: pkg: pkg) - attrSet; + if attrSet == null then + builtins.throw "Attribute path `${path}` does not exists." + else + packagesWith (name: pkg: builtins.hasAttr "updateScript" pkg) + (name: pkg: pkg) + attrSet; packageByName = name: let