Skip to content

Commit 4474272

Browse files
[v18] Check err != nil before calling err.Error() in tbot db tunnel service (#64574)
* Check err != nil before calling err.Error() in tbot db tunnel service If the local proxy Start() method returns a nil error, we do a nil pointer deference. This does a check first. * fmt * Report unhealthy even if err is nil
1 parent d4e6c43 commit 4474272

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/tbot/services/database/tunnel_service.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ func (s *TunnelService) Run(ctx context.Context) error {
241241
case <-ctx.Done():
242242
return nil
243243
case err := <-errCh:
244-
s.statusReporter.ReportReason(readyz.Unhealthy, err.Error())
244+
if err != nil {
245+
s.statusReporter.ReportReason(readyz.Unhealthy, err.Error())
246+
} else {
247+
s.statusReporter.Report(readyz.Unhealthy)
248+
}
245249
return trace.Wrap(err, "local proxy failed")
246250
}
247251
}

0 commit comments

Comments
 (0)