Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Nil pointer if GPU does not provide device info #3108

Merged
merged 3 commits into from
Dec 9, 2023

Conversation

atterpac
Copy link
Member

@atterpac atterpac commented Dec 9, 2023

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Linux

Test Configuration

`
Wails Doctor

Wails

Version | v2.7.0
Revision | f517c8b
Modified | true
Package Manager | apt

System

┌───────────────────────────────────────────────────┐
| OS | Ubuntu |
| Version | 22.04 |
| ID | ubuntu |
| Go Version | go1.21.1 |
| Platform | linux |
| Architecture | amd64 |
| CPU | AMD Ryzen 7 3700X 8-Core Processor |
| GPU | Unknown |
| Memory | 12GB |
└───────────────────────────────────────────────────┘

Dependencies

┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status | Version |
| *docker | docker.io | Installed | 24.0.5-0ubuntu1~22.04.1 |
| gcc | build-essential | Installed | 12.9ubuntu3 |
| libgtk-3 | libgtk-3-dev | Installed | 3.24.33-1ubuntu2 |
| libwebkit | libwebkit2gtk-4.0-dev | Installed | 2.42.2-0ubuntu0.22.04.1 |
| npm | npm | Installed | 9.8.1 |
| *nsis | nsis | Installed | v3.08-2 |
| pkg-config | pkg-config | Installed | 0.29.2-1ubuntu3 |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

Diagnosis

SUCCESS Your system is ready for Wails development!

♥ If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony`

Summary by CodeRabbit

  • Bug Fixes
    • Resolved an issue where wails doctor would crash if GPU device information was not available. (#3108)

Copy link
Contributor

coderabbitai bot commented Dec 9, 2023

Walkthrough

The recent updates focus on a fix within the Wails framework, specifically addressing a segmentation fault in the wails doctor command when GPU device information is not available. The fix ensures stability by handling cases where the device information might be missing, preventing the command from crashing and instead reporting an "Unknown" status.

Changes

File Path Change Summary
v2/cmd/wails/doctor.go Added logic to handle nil DeviceInfo to prevent segfaults.
website/.../changelog.mdx Updated the changelog to reflect the fix for the wails doctor segfault issue, crediting @atterpac for the contribution.

🐇✨
A little bug in the code did hide,
Causing wails doctor to collide.
But with a hop and a fix in stride,
Now smoothly it runs, far and wide. 🛠️🎉


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

@atterpac atterpac marked this pull request as ready for review December 9, 2023 16:57
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f517c8b and 0eb2b52.
Files selected for processing (2)
  • v2/cmd/wails/doctor.go (1 hunks)
  • website/src/pages/changelog.mdx (1 hunks)
Additional comments: 2
v2/cmd/wails/doctor.go (2)
  • 104-113: The addition of the nil check for card.DeviceInfo is a good defensive programming practice to prevent potential nil pointer dereferences when the GPU does not provide device information. This change correctly implements the PR's objective to fix the nil pointer exception issue.

  • 104-113: The changes are localized and do not affect any exported or public entities, which is consistent with the PR's non-breaking change claim.

Comment on lines 14 to 18

## [Unreleased]

- Fix `wails doctor` segfault if device does not provide gpu information.
Fixed by [@atterpac](https://github.com/atterpac) in [3108](https://github.com/wailsapp/wails/pull/3108)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog entry for the unreleased section is not following the standard format. It should be categorized under Fixed and use the markdown link syntax for the user and PR references.

## [Unreleased]
- Fix `wails doctor` segfault if device does not provide gpu information.
- Fixed by [@atterpac](https://github.com/atterpac) in [3108](https://github.com/wailsapp/wails/pull/3108)

Should be:

## [Unreleased]
### Fixed
- Segfault in `wails doctor` when GPU device information is not provided. Thanks to [@atterpac](https://github.com/atterpac) for the fix ([#3108](https://github.com/wailsapp/wails/pull/3108)).

Copy link
Member

@leaanthony leaanthony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers!

@leaanthony leaanthony merged commit e3af094 into wailsapp:master Dec 9, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants