Skip to content

Commit

Permalink
fix: fix nil pointer
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <[email protected]>
  • Loading branch information
zong-zhe committed Sep 6, 2024
1 parent 6fe8066 commit d8f13a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/client/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"path/filepath"

orderedmap "github.com/elliotchance/orderedmap/v2"
"kcl-lang.io/kpm/pkg/downloader"
pkg "kcl-lang.io/kpm/pkg/package"
)
Expand Down Expand Up @@ -40,11 +41,11 @@ func (c *KpmClient) Update(options ...UpdateOption) (*pkg.KclPkg, error) {

modDeps := kpkg.ModFile.Dependencies.Deps
if modDeps == nil {
return nil, fmt.Errorf("kcl.mod dependencies is nil")
return kpkg, nil
}
lockDeps := kpkg.Dependencies.Deps
if lockDeps == nil {
return nil, fmt.Errorf("kcl.mod.lock dependencies is nil")
lockDeps = orderedmap.NewOrderedMap[string, pkg.Dependency]()
}

// Create a new dependency resolver
Expand Down

0 comments on commit d8f13a8

Please sign in to comment.