Skip to content

Commit

Permalink
newt: Fix crash when package is missing
Browse files Browse the repository at this point in the history
When package from build was missing the b.Build() was returning
an error before AppBuilder was created. It was resulting in
dereferencing null pointer in such situation.
  • Loading branch information
m-gorecki committed Mar 11, 2024
1 parent 679b6a8 commit ca0e1d3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions newt/cli/build_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,12 @@ func buildRunCmd(cmd *cobra.Command, args []string, printShellCmds bool, execute
}

if err := b.Build(); err != nil {
if b.AppBuilder.GetModifiedRepos() != nil {
util.ErrorMessage(util.VERBOSITY_DEFAULT,
"Warning: Following external repos are modified or missing, which might be causing build errors:\n%v\n",
b.AppBuilder.GetModifiedRepos())
if b.AppBuilder != nil {
if b.AppBuilder.GetModifiedRepos() != nil {
util.ErrorMessage(util.VERBOSITY_DEFAULT,
"Warning: Following external repos are modified or missing, which might be causing build errors:\n%v\n",
b.AppBuilder.GetModifiedRepos())
}
}
NewtUsage(nil, err)
}
Expand Down

0 comments on commit ca0e1d3

Please sign in to comment.