From 6d747b2f83c147a44b98ac8da7ae80c79c7e0995 Mon Sep 17 00:00:00 2001 From: Deniz Adrian Date: Wed, 6 Mar 2024 14:32:34 +0100 Subject: [PATCH] Do not fail on virtualized windows systems (#1669) this handles virtualized systems without Win32_ComputerSystemProduct entries by returning 'unknown' for system product name Co-authored-by: Bjoern Brauer --- client/system/info_windows.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/system/info_windows.go b/client/system/info_windows.go index b86810593..68631fe16 100644 --- a/client/system/info_windows.go +++ b/client/system/info_windows.go @@ -165,6 +165,10 @@ func sysProductName() (string, error) { if err != nil { return "", err } + // `ComputerSystemProduct` could be empty on some virtualized systems + if len(dst) < 1 { + return "unknown", nil + } return dst[0].Name, nil }