Skip to content

Commit

Permalink
fix NPE in cv add (#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandelsoft authored Apr 5, 2023
1 parent d926595 commit 72bd6ba
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmds/ocm/commands/ocmcmds/components/add/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,13 @@ func (o *Command) Run() error {
}
}

var repo ocm.Repository
openmode := accessobj.ACC_WRITABLE
if o.Create {
repo, err = ctf.Create(o.Context.OCMContext(), accessobj.ACC_CREATE, fp, mode, o.Handler, fs)
} else {
repo, err = ctf.Open(o.Context.OCMContext(), accessobj.ACC_WRITABLE, fp, mode, fs)
openmode |= accessobj.ACC_CREATE
}
repo, err := ctf.Open(o.Context.OCMContext(), openmode, fp, mode, o.Handler, fs)
if err != nil {
return err
}

thdlr, err := standard.New(standard.KeepGlobalAccess(), standard.Recursive(), rscbyvalueoption.From(o))
Expand Down

0 comments on commit 72bd6ba

Please sign in to comment.