diff --git a/mlx/distributed/utils.cpp b/mlx/distributed/utils.cpp index ef52ec09..2de994cf 100644 --- a/mlx/distributed/utils.cpp +++ b/mlx/distributed/utils.cpp @@ -184,7 +184,9 @@ TCPSocket TCPSocket::connect( break; } - cb(attempt, wait); + if (cb != nullptr) { + cb(attempt, wait); + } if (wait > 0) { std::this_thread::sleep_for(std::chrono::milliseconds(wait)); }