diff --git a/newt/repo/repo.go b/newt/repo/repo.go index 070cc452e..a2767d680 100644 --- a/newt/repo/repo.go +++ b/newt/repo/repo.go @@ -198,7 +198,11 @@ func (r *Repo) Name() string { } func (r *Repo) Path() string { - return r.localPath + if r != nil { + return r.localPath + } else { + return "" + } } func (r *Repo) IsLocal() bool { diff --git a/newt/sysinit/sysinit.go b/newt/sysinit/sysinit.go index ee1caf3cf..c6d619a02 100644 --- a/newt/sysinit/sysinit.go +++ b/newt/sysinit/sysinit.go @@ -163,7 +163,6 @@ func ResolveStageFuncsOrder(sfs []stage.StageFunc) ([]stage.StageFunc, error) { sort.Slice(nodesQ, func(i int, j int) bool { a := nodesQ[i] b := nodesQ[j] - if strings.Compare(a.Name, b.Name) == -1 { return false } @@ -181,6 +180,10 @@ func ResolveStageFuncsOrder(sfs []stage.StageFunc) ([]stage.StageFunc, error) { // direct dependencies between each node of stage X to each node of // stage Y to make sure they can be resolved properly and reordered // if needed due to other dependencies. + if stages == nil { + util.FmtNewtError("Cannot resolve sysinit order: no stages defined.") + return []stage.StageFunc{}, nil + } sfsPrev := nodesByStage[stages[0]] stages = stages[1:] for _, stage := range stages {