diff --git a/quesma/elasticsearch/index_management.go b/quesma/elasticsearch/index_management.go index 5d58ff1d5..d4caeb8a7 100644 --- a/quesma/elasticsearch/index_management.go +++ b/quesma/elasticsearch/index_management.go @@ -50,12 +50,17 @@ func (im *indexManagement) ReloadIndices() { } func (im *indexManagement) GetSources() Sources { - return *im.sources.Load() + if s := im.sources.Load(); s != nil { + return *s + } else { + logger.Warn().Msg("Indices are not yet loaded, returning empty sources.") + return Sources{} + } } func (im *indexManagement) GetSourceNames() map[string]bool { names := make(map[string]bool) - sources := *im.sources.Load() + sources := im.GetSources() for _, stream := range sources.DataStreams { names[stream.Name] = true }