1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +00:00

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. :^)
This commit is contained in:
Linus Groh 2021-05-21 19:20:43 +01:00
parent be3f4c86de
commit 9003dd907e

View file

@ -294,6 +294,8 @@ static void print_array_buffer(const JS::Object& object, HashTable<JS::Object*>&
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]);