Skip to content

Commit

Permalink
fix unhandled error leading to the panic
Browse files Browse the repository at this point in the history
In the case when connection to the NGS is refused.

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1f590b4]

goroutine 1 [running]:
github.com/mantil-io/mantil/cli/controller/invoke.(*LambdaClient).Do(0xc000663a10, {0x2403a72, 0x6}, {0x218bf40, 0xc000438000}, {0x218bf80, 0xc000afc020})
	github.com/mantil-io/mantil/cli/controller/invoke/invoke.go:239 +0x134
github.com/mantil-io/mantil/cli/controller.(*Setup).create(0xc000414f00, 0xc00020cc40)
	github.com/mantil-io/mantil/cli/controller/setup.go:133 +0x3c8
github.com/mantil-io/mantil/cli/controller.(*Setup).Create(0xc000414f00, 0xc0005a5c20)
	github.com/mantil-io/mantil/cli/controller/setup.go:91 +0x325
github.com/mantil-io/mantil/cli/cmd.newAwsInstallCommand.func1(0xc0003bd400, {0xc0003a27c0, 0x2, 0x2})
	github.com/mantil-io/mantil/cli/cmd/commands.go:80 +0x1a7
github.com/spf13/cobra.(*Command).execute(0xc0003bd400, {0xc0003a27a0, 0x2, 0x2})
	github.com/spf13/[email protected]/command.go:856 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0xc000377680)
	github.com/spf13/[email protected]/command.go:974 +0x3bc
github.com/mantil-io/mantil/cli/cmd.Execute()
	github.com/mantil-io/mantil/cli/cmd/root.go:24 +0x3e
main.run()
	github.com/mantil-io/mantil/cli/main.go:75 +0x275
main.main()
	github.com/mantil-io/mantil/cli/main.go:27 +0x2e
```
  • Loading branch information
ianic committed Dec 4, 2021
1 parent 0f71832 commit b041e7e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cli/controller/invoke/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ func Lambda(invoker Invoker, functionName string, logSink LogSinkCallback) *Lamb

func (l *LambdaClient) Do(method string, req, rsp interface{}) error {
lsn, err := newListener(nil, rsp, l.logSink)
if err != nil {
return err
}

var payload []byte
if req != nil {
Expand Down

0 comments on commit b041e7e

Please sign in to comment.