about summary refs log tree commit diff
path: root/third_party/nix
diff options
context:
space:
mode:
authorKane York <kanepyork@gmail.com>2020-07-24T02·05-0700
committerkanepyork <rikingcoding@gmail.com>2020-07-24T22·15+0000
commit388b5f1abe8947978592d9778a5669e634b6e552 (patch)
tree6b9574b17a31e0eaf76e523bdbb73be9e1e57b25 /third_party/nix
parente191e0afadb29c671f39b235a47caecc052a5b20 (diff)
fix(3p/nix): fix null pointer dereferences r/1456
Change-Id: I4c37febcd4978f17720b2526c267c6bf96e84bcc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1417
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'third_party/nix')
-rw-r--r--third_party/nix/src/build-remote/build-remote.cc4
1 files 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 82ac2014ef75..0aeadd0510d2 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 {