Commit 1d9cb22
authored
fix(controller): prevent panic on shutdown due to nil pointer (#847)
Prevents following error if controller fails to initialise database on
startup (e.g. if it happens to run out of memory when loading the db).
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1a3158e]
goroutine 107 [running]:
github.com/kagent-dev/kagent/go/internal/database.(*Manager).Close(0xc00024ea00?)
/workspace/internal/database/manager.go:144 +0xe
github.com/kagent-dev/kagent/go/internal/httpserver.(*HTTPServer).Start.func2()
/workspace/internal/httpserver/server.go:110 +0x116
created by github.com/kagent-dev/kagent/go/internal/httpserver.(*HTTPServer).Start in goroutine 104
/workspace/internal/httpserver/server.go:101 +0x288
```
Signed-off-by: Brian Fox <878612+onematchfox@users.noreply.github.com>1 parent 20baa60 commit 1d9cb22
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
144 | 148 | | |
145 | 149 | | |
146 | 150 | | |
| |||
0 commit comments