this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix nil pointer deref for ErrAccountRepoNotFound (#1142)

this change just makes sure `repo` is not nil before we try to pull a
`Rev` out of it.

assigning the Rev from the repo follows what's *almost* a boilerplate
golang error handler, but is sneakily not handling
`relay.ErrAccountRepoNotFound` -- seems the intent is to provide a
happy-path response for a common error case.

unfortunately the Rev assignment tried to dereference that from `repo`
unconditionally, so it panicked in the allowed-error path.


(still need to test and will verify on my relays)

authored by

bnewbold and committed by
GitHub
f4a83980 8be10287

+4 -1
+4 -1
cmd/relay/handlers.go
··· 197 197 if err != nil && !errors.Is(err, relay.ErrAccountRepoNotFound) { 198 198 return nil, err 199 199 } 200 + // ^^ only returns for non-ErrAccountRepoNotFound: repo can be nil after this! 200 201 201 - out.Rev = &repo.Rev 202 + if repo != nil { 203 + out.Rev = &repo.Rev 204 + } 202 205 203 206 return out, nil 204 207 }