mirror of
https://github.com/turbot/steampipe.git
synced 2026-02-27 11:01:05 -05:00
* Add test for #4755: Nil pointer dereference in State.reattachConfig() * Fix #4755: Add nil check in State.reattachConfig()
28 lines
702 B
Go
28 lines
702 B
Go
package pluginmanager
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hashicorp/go-plugin"
|
|
)
|
|
|
|
// TestStateWithNilAddr tests that reattachConfig handles nil Addr gracefully
|
|
// This test demonstrates bug #4755
|
|
func TestStateWithNilAddr(t *testing.T) {
|
|
state := &State{
|
|
Protocol: plugin.ProtocolGRPC,
|
|
ProtocolVersion: 1,
|
|
Pid: 12345,
|
|
Executable: "/usr/local/bin/steampipe",
|
|
Addr: nil, // Nil address - this will cause panic without fix
|
|
}
|
|
|
|
// This should not panic - it should return nil gracefully
|
|
config := state.reattachConfig()
|
|
|
|
// With nil Addr, we expect nil config (not a panic)
|
|
if config != nil {
|
|
t.Error("Expected nil reattach config when Addr is nil")
|
|
}
|
|
}
|