mirror of
https://github.com/tailscale/tailscale.git
synced 2026-09-22 03:25:16 -04:00
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>