Skip to content

Commit 1b2038b

Browse files
darthcavclaude
andcommitted
fix: add nil guards for DeviceInfo fields in GPU detection functions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a0290ff commit 1b2038b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

pkg/inference/backends/llamacpp/gpuinfo_windows.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ func hasNVIDIAGPU() (bool, error) {
2020
return false, err
2121
}
2222
for _, gpu := range gpus.GraphicsCards {
23+
if gpu.DeviceInfo == nil || gpu.DeviceInfo.Vendor == nil {
24+
continue
25+
}
2326
if strings.ToLower(gpu.DeviceInfo.Vendor.Name) == "nvidia" {
2427
return true, nil
2528
}
@@ -65,6 +68,9 @@ func hasSupportedAdrenoGPU() (bool, error) {
6568
return false, err
6669
}
6770
for _, gpu := range gpus.GraphicsCards {
71+
if gpu.DeviceInfo == nil || gpu.DeviceInfo.Product == nil {
72+
continue
73+
}
6874
isAdrenoFamily := strings.Contains(gpu.DeviceInfo.Product.Name, "Adreno") ||
6975
strings.Contains(gpu.DeviceInfo.Product.Name, "Qualcomm")
7076
if isAdrenoFamily {
@@ -109,6 +115,9 @@ func hasVulkanCapableGPU() (bool, error) {
109115
return false, err
110116
}
111117
for _, gpu := range gpus.GraphicsCards {
118+
if gpu.DeviceInfo == nil || gpu.DeviceInfo.Vendor == nil || gpu.DeviceInfo.Product == nil {
119+
continue
120+
}
112121
vendor := strings.ToLower(gpu.DeviceInfo.Vendor.Name)
113122
product := gpu.DeviceInfo.Product.Name
114123
isNVIDIA := vendor == "nvidia"

0 commit comments

Comments
 (0)