storage: Avoid panic when no previous versions in history (#88880)

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
pull/88818/head^2
Dave Henderson 12 months ago committed by GitHub
parent 003e3efce9
commit c931a44503
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      pkg/services/store/entity/sqlstash/sql_storage_server.go

@ -1095,6 +1095,11 @@ func (s *sqlEntityServer) poll(since int64, out chan *entity.EntityWatchResponse
return err
}
if len(history.Versions) == 0 {
ctxLogger.Error("error reading previous entity", "guid", updated.Guid, "err", "no previous version found")
return errors.New("no previous version found")
}
result.Previous = history.Versions[0]
}

Loading…
Cancel
Save