From 8545756d17799aaf3dec9b3b46caa3b9b74c0d9f Mon Sep 17 00:00:00 2001 From: Gasim Gasimzada Date: Thu, 8 Aug 2024 21:54:14 +0200 Subject: [PATCH] LibJS: Treat passing undefined as no argument for console labels - Affects time, timeLog, timeEnd, count, and countReset functions --- Userland/Libraries/LibJS/Console.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Console.cpp b/Userland/Libraries/LibJS/Console.cpp index 9a32e29036c..513a75eb9c8 100644 --- a/Userland/Libraries/LibJS/Console.cpp +++ b/Userland/Libraries/LibJS/Console.cpp @@ -203,7 +203,7 @@ ThrowCompletionOr Console::dir() static ThrowCompletionOr label_or_fallback(VM& vm, StringView fallback) { - return vm.argument_count() > 0 + return vm.argument_count() > 0 && !vm.argument(0).is_undefined() ? vm.argument(0).to_string(vm) : TRY_OR_THROW_OOM(vm, String::from_utf8(fallback)); }