From 388b5f1abe8947978592d9778a5669e634b6e552 Mon Sep 17 00:00:00 2001 From: Kane York Date: Thu, 23 Jul 2020 19:05:41 -0700 Subject: [PATCH] fix(3p/nix): fix null pointer dereferences Change-Id: I4c37febcd4978f17720b2526c267c6bf96e84bcc Reviewed-on: https://cl.tvl.fyi/c/depot/+/1417 Tested-by: BuildkiteCI Reviewed-by: tazjin --- third_party/nix/src/build-remote/build-remote.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/nix/src/build-remote/build-remote.cc b/third_party/nix/src/build-remote/build-remote.cc index 82ac2014e..0aeadd051 100644 --- a/third_party/nix/src/build-remote/build-remote.cc +++ b/third_party/nix/src/build-remote/build-remote.cc @@ -147,7 +147,7 @@ static int _main(int argc, char* argv[]) { continue; } bool best = false; - if (!bestSlotLock) { + if (!bestMachine || !bestSlotLock) { best = true; } else if (load / m.speedFactor < bestLoad / bestMachine->speedFactor) { @@ -170,7 +170,7 @@ static int _main(int argc, char* argv[]) { } } - if (!bestSlotLock) { + if (!bestSlotLock || !bestMachine) { if (rightType && !canBuildLocally) { std::cerr << "# postpone\n"; } else {