Add extra check for GPU device info for null pointer (#3032)

* add check for GPU device info

* add changelog note

* change return to continue

* Small refactor

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
Light
2023-11-06 20:51:03 +11:00
committed by GitHub
co-authored by Lea Anthony
parent 36a3e90b1d
commit 7c15f9098c
2 changed files with 11 additions and 9 deletions
+10 -9
View File
@@ -2,17 +2,18 @@ package doctor
import (
"fmt"
"path/filepath"
"runtime"
"runtime/debug"
"slices"
"strconv"
"github.com/go-git/go-git/v5"
"github.com/jaypipes/ghw"
"github.com/pterm/pterm"
"github.com/samber/lo"
"github.com/wailsapp/wails/v3/internal/operatingsystem"
"github.com/wailsapp/wails/v3/internal/version"
"path/filepath"
"runtime"
"runtime/debug"
"slices"
"strconv"
)
func Run() (err error) {
@@ -155,12 +156,12 @@ func Run() (err error) {
// Probe GPU
gpu, _ := ghw.GPU(ghw.WithDisableWarnings())
if gpu != nil {
prefix := "GPU"
for idx, card := range gpu.GraphicsCards {
if len(gpu.GraphicsCards) > 1 {
prefix = "GPU " + strconv.Itoa(idx+1) + " "
details := "Unknown"
prefix := "GPU " + strconv.Itoa(idx+1)
if card.DeviceInfo != nil {
details = fmt.Sprintf("%s (%s) - Driver: %s ", card.DeviceInfo.Product.Name, card.DeviceInfo.Vendor.Name, card.DeviceInfo.Driver)
}
details := fmt.Sprintf("%s (%s) - Driver: %s", card.DeviceInfo.Product.Name, card.DeviceInfo.Vendor.Name, card.DeviceInfo.Driver)
systemTabledata = append(systemTabledata, []string{prefix, details})
}
} else {
+1
View File
@@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#### Fixed
- Fixed typo on docs/reference/options page. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2887)
- Fixed bug for linux in doctor in the event user doesn't have proper drivers installed. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/3032)
## v2.6.0 - 2023-09-06