From 373e4871e0659f56e9b91db736914f1016ac1ddd Mon Sep 17 00:00:00 2001 From: Philip Carneiro Date: Fri, 24 May 2024 11:41:02 +0100 Subject: [PATCH] improve the code --- src/commands/serverCommand.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/serverCommand.ts b/src/commands/serverCommand.ts index 6a928b7e..6f642921 100644 --- a/src/commands/serverCommand.ts +++ b/src/commands/serverCommand.ts @@ -570,9 +570,9 @@ export function writeQueryResultsToConsole( duration?: string, ): void { const queryConsole = ExecutionConsole.start(); - const res = Array.isArray(result) - ? decodeQUTF(result[0]) - : decodeQUTF(result); + const isNonEmptyArray = Array.isArray(result) && result.length > 0; + const valueToDecode = isNonEmptyArray ? result[0] : result.toString(); + const res = decodeQUTF(valueToDecode); if (!res.startsWith(queryConstants.error)) { queryConsole.append( res,