From 9003dd907e795b956538be6b76c2729bf01ceb14 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 21 May 2021 19:20:43 +0100 Subject: [PATCH] js: Don't print newline for empty ArrayBuffer If we don't have any bytes to print in hex representation, just return early instead of printing a newline in preparation for the data that won't follow. :^) --- Userland/Utilities/js.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index 978a92c5c2..ae24ac0ec6 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -294,6 +294,8 @@ static void print_array_buffer(const JS::Object& object, HashTable& print_type("ArrayBuffer"); out("\n byteLength: "); print_value(JS::Value((double)byte_length), seen_objects); + if (!byte_length) + return; outln(); for (size_t i = 0; i < byte_length; ++i) { out("{:02x}", buffer[i]);