From e668ed0ac5d51968eacdc241de01c2e76a3c1bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Mon, 3 Jan 2022 08:58:35 +0100 Subject: [PATCH] weldr: return an error if host distro wasn't found in distro registry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents a nil panic, see rhbz#2035956 Signed-off-by: Ondřej Budai --- internal/weldr/api.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/weldr/api.go b/internal/weldr/api.go index a9fc95aa5..df3b33b29 100644 --- a/internal/weldr/api.go +++ b/internal/weldr/api.go @@ -155,6 +155,10 @@ func New(repoPaths []string, stateDir string, rpm rpmmd.RPMMD, dr *distroregistr archName := common.CurrentArch() hostDistro := dr.GetDistro(hostDistroName) + if hostDistro == nil { + return nil, fmt.Errorf("host distro is not supported") + } + hostArch, err := hostDistro.GetArch(archName) if err != nil { return nil, fmt.Errorf("Host distro does not support host architecture: %v", err)