Files
tailscale/util/ringlog
Aman Jain 08a9050b18 util/ringlog: make Clear a no-op on a nil RingLog
Add, GetAll and Len all check for a nil receiver and document that they
do nothing, because a nil *RingLog is how callers represent a disabled
log: magicsock leaves endpoint.debugUpdates nil on iOS and Android to
save memory, and calls Add on it unconditionally.

Clear was the one method without that check, so it would panic on those
platforms. Nothing calls it on a nil log today, so this is a latent
footgun rather than an observed crash, but the inconsistency is easy to
fall into. Add the check and a test covering all four methods.

Updates #cleanup

Change-Id: Ic13693a27ad404f0e27906f4010980c9dafb7cc2
Signed-off-by: Aman Jain <jn_aman@yahoo.com>
2026-09-14 21:06:33 -07:00
..