heal: Fix first entry on dangling (#14495)

Instead of the first, the last entry was returned
pointerizing the range value.
This commit is contained in:
Klaus Post
2022-03-08 09:04:20 -08:00
committed by GitHub
parent 21d8298fe1
commit 8a274169da
2 changed files with 17 additions and 7 deletions
+2 -2
View File
@@ -389,11 +389,11 @@ func (m metaCacheEntries) resolve(r *metadataResolutionParams) (selected *metaCa
// firstFound returns the first found and the number of set entries.
func (m metaCacheEntries) firstFound() (first *metaCacheEntry, n int) {
for _, entry := range m {
for i, entry := range m {
if entry.name != "" {
n++
if first == nil {
first = &entry
first = &m[i]
}
}
}