1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 06:21:14 +02:00

Fix underflow in Printer::printList

Analogous to 9b88bf8adf / three commits back
This commit is contained in:
Robert Hensing 2024-06-29 14:08:43 +02:00
parent bfc5416240
commit b2c7f09b0a
3 changed files with 25 additions and 1 deletions

View file

@ -405,11 +405,14 @@ private:
output << "[";
auto listItems = v.listItems();
auto prettyPrint = shouldPrettyPrintList(listItems);
size_t currentListItemsPrinted = 0;
for (auto elem : listItems) {
printSpace(prettyPrint);
if (totalListItemsPrinted >= options.maxListItems) {
printElided(listItems.size() - totalListItemsPrinted, "item", "items");
printElided(listItems.size() - currentListItemsPrinted, "item", "items");
break;
}
@ -419,6 +422,7 @@ private:
printNullptr();
}
totalListItemsPrinted++;
currentListItemsPrinted++;
}
decreaseIndent();