weldr: return an error if host distro wasn't found in distro registry

Prevents a nil panic, see rhbz#2035956

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2022-01-03 08:58:35 +01:00 committed by Tom Gundersen
parent bcf34f8c6c
commit e668ed0ac5

View file

@ -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)