From aa017342bfda3e79dee640bcc336bcec5bf0c094 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Mon, 27 May 2024 17:46:02 -0400 Subject: cmd/mi/services/switchtracker: fix getting individual switches, add tests Signed-off-by: Xe Iaso --- cmd/mi/models/switch.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmd/mi/models/switch.go') diff --git a/cmd/mi/models/switch.go b/cmd/mi/models/switch.go index ec85a1c..5a16dd6 100644 --- a/cmd/mi/models/switch.go +++ b/cmd/mi/models/switch.go @@ -17,7 +17,11 @@ type Switch struct { } // AsProto converts a Switch to its protobuf representation. -func (s Switch) AsProto() *pb.Switch { +func (s *Switch) AsProto() *pb.Switch { + if s == nil { + return nil + } + var endedAt string if s.EndedAt != nil { -- cgit v1.2.3