This is an automated email from the ASF dual-hosted git repository. jerzy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
The following commit(s) were added to refs/heads/master by this push: new 161ff622 newt: Fix crash when package is missing 161ff622 is described below commit 161ff622bd7d1bd3311fd0716c84978795040ebf Author: Michal Gorecki <michal.gore...@codecoup.pl> AuthorDate: Mon Mar 11 14:40:41 2024 +0100 newt: Fix crash when package is missing 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. --- newt/cli/build_cmds.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/newt/cli/build_cmds.go b/newt/cli/build_cmds.go index 309b4345..ce161153 100644 --- a/newt/cli/build_cmds.go +++ b/newt/cli/build_cmds.go @@ -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) }