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 authored and kasjer committed Mar 11, 2024
1 parent c558063 commit 161ff62
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions newt/cli/build_cmds.go
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 161ff62

Please sign in to comment.