This commit is contained in:
Eelco Dolstra 2020-07-01 15:31:34 +02:00
parent 86a4aba6c4
commit 38ccf2e241

View file

@ -42,15 +42,12 @@ std::map<string, StorePath> readOutputPathMap(const Store & store, Source & from
{ {
std::map<string, StorePath> pathMap; std::map<string, StorePath> pathMap;
auto rawInput = readStrings<Strings>(from); auto rawInput = readStrings<Strings>(from);
if (rawInput.size() % 2)
throw Error("got an odd number of elements from the daemon when trying to read a output path map");
auto curInput = rawInput.begin(); auto curInput = rawInput.begin();
while (curInput != rawInput.end()) { while (curInput != rawInput.end()) {
string thisKey = *curInput; auto thisKey = *curInput++;
curInput = std::next(curInput); auto thisValue = *curInput++;
if (curInput == rawInput.end()) {
throw Error("Got an odd number of elements from the daemon when trying to read a map… that's odd");
}
string thisValue = *curInput;
curInput = std::next(curInput);
pathMap.emplace(thisKey, store.parseStorePath(thisValue)); pathMap.emplace(thisKey, store.parseStorePath(thisValue));
} }
return pathMap; return pathMap;