diff --git a/pkg/initialisation/init_data.go b/pkg/initialisation/init_data.go index 00e564503..d0b291696 100644 --- a/pkg/initialisation/init_data.go +++ b/pkg/initialisation/init_data.go @@ -46,6 +46,10 @@ func NewInitData() *InitData { func (i *InitData) RegisterExporters(exporters ...export.Exporter) *InitData { for _, e := range exporters { + // Skip nil exporters to prevent nil pointer panic + if e == nil { + continue + } if err := i.ExportManager.Register(e); err != nil { // short circuit if there is an error i.Result.Error = err diff --git a/pkg/initialisation/init_data_test.go b/pkg/initialisation/init_data_test.go index 87e73e478..3afcb729d 100644 --- a/pkg/initialisation/init_data_test.go +++ b/pkg/initialisation/init_data_test.go @@ -110,7 +110,7 @@ func TestInitData_CleanupIdempotency(t *testing.T) { // TestInitData_NilExporter tests registering nil exporters func TestInitData_NilExporter(t *testing.T) { - t.Skip("Demonstrates bug #4750 - HIGH nil pointer panic when registering nil exporter. Remove this skip in bug fix PR commit 1, then fix in commit 2.") + // t.Skip("Demonstrates bug #4750 - HIGH nil pointer panic when registering nil exporter. Remove this skip in bug fix PR commit 1, then fix in commit 2.") initData := NewInitData() // Register nil exporter - should this panic or handle gracefully?