Skip to content

Commit

Permalink
Add extra check for GPU device info for null pointer (#3032)
Browse files Browse the repository at this point in the history
* add check for GPU device info

* add changelog note

* change return to continue

* Small refactor

---------

Co-authored-by: Lea Anthony <[email protected]>
  • Loading branch information
PylotLight and leaanthony authored Nov 6, 2023
1 parent 36a3e90 commit 7c15f90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 10 additions & 9 deletions v3/internal/doctor/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7c15f90

Please sign in to comment.