From 39cba349bdf74ea422e80336ab1fd246fc4c49e6 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Thu, 10 Aug 2023 16:12:05 -0400 Subject: [PATCH] fix(striker-ui-api): handle empty select host detail query return --- .../src/lib/request_handlers/host/buildQueryHostDetail.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts b/striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts index b3456e24..40831a96 100644 --- a/striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts +++ b/striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts @@ -80,7 +80,11 @@ export const buildQueryHostDetail: BuildQueryDetailFunction = ({ const afterQueryReturn: QueryResultModifierFunction = buildQueryResultModifier((output) => { - const [hostName, hostType, hostUUID] = output[0]; + if (output.length === 0) return {}; + + const { + 0: [hostName, hostType, hostUUID], + } = output; const shortHostName = getShortHostName(hostName); return output.reduce<