diff options
author | Alain Zscheile <zseri.devel@ytrizja.de> | 2022-05-04 07:44:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 07:44:32 +0200 |
commit | 1385b2007804c8a0370f2a6555045a00e34b07c7 (patch) | |
tree | 3f83e56e03bd60d6c07d0ee14e70949df04b9e0f /src/libstore/build/worker.cc | |
parent | 9489b4b7ef73ab20e8f49213d8711ca56b59107e (diff) |
Get rid of most `.at` calls (#6393)
Use one of `get` or `getOr` instead which will either return a null-pointer (with a nicer error message) or a default value when the key is missing.
Diffstat (limited to 'src/libstore/build/worker.cc')
-rw-r--r-- | src/libstore/build/worker.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index f72c1cc9c..e7c01a737 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -380,7 +380,10 @@ void Worker::waitForInput() std::set<int> fds2(j->fds); std::vector<unsigned char> buffer(4096); for (auto & k : fds2) { - if (pollStatus.at(fdToPollStatus.at(k)).revents) { + const auto fdPollStatusId = get(fdToPollStatus, k); + assert(fdPollStatusId); + assert(*fdPollStatusId < pollStatus.size()); + if (pollStatus.at(*fdPollStatusId).revents) { ssize_t rd = ::read(k, buffer.data(), buffer.size()); // FIXME: is there a cleaner way to handle pt close // than EIO? Is this even standard? |