From c14504ce0b9fccdd16ff3d22b3606a9c0c699a59 Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Mon, 17 Oct 2022 07:02:36 +0200 Subject: [PATCH] tools/dumpnbt: Display empty lists correctly --- src/tools/dumpnbt.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tools/dumpnbt.cpp b/src/tools/dumpnbt.cpp index 8bc3db3..678b1be 100644 --- a/src/tools/dumpnbt.cpp +++ b/src/tools/dumpnbt.cpp @@ -203,8 +203,12 @@ void drawTree(NBT::Tag::Generic* tag, tiny_utf8::string prefix, uint64_t offsetB } std::cout << std::endl; - std::cout << prefix << "|–Length: " << list->length() << std::endl; - std::cout << prefix << "|" << std::endl; + if (list->length() > 0) { + std::cout << prefix << "|–Length: " << list->length() << std::endl; + std::cout << prefix << "|" << std::endl; + } else { + std::cout << prefix << "'–Length: " << list->length() << std::endl; + } offsetBytes = offsetBytes + headerSize + 5; for (uint64_t i=0; ilength(); i++) {