git/dumpTree: Assert name not empty before back()

This commit is contained in:
Robert Hensing 2024-03-24 00:54:44 +01:00
parent 850c9a6caf
commit 3b7f2bf997

View file

@ -251,6 +251,7 @@ void dumpTree(const Tree & entries, Sink & sink,
for (auto & [name, entry] : entries) { for (auto & [name, entry] : entries) {
auto name2 = name; auto name2 = name;
if (entry.mode == Mode::Directory) { if (entry.mode == Mode::Directory) {
assert(!name2.empty());
assert(name2.back() == '/'); assert(name2.back() == '/');
name2.pop_back(); name2.pop_back();
} }