Skip to content

Ensure studio_bundle_to_use is not None before accessing is_dev a…#292

Merged
iLLiCiTiT merged 2 commits intoynput:developfrom
Dariusz1989:develop
Mar 6, 2026
Merged

Ensure studio_bundle_to_use is not None before accessing is_dev a…#292
iLLiCiTiT merged 2 commits intoynput:developfrom
Dariusz1989:develop

Conversation

@Dariusz1989
Copy link
Copy Markdown
Contributor

Ensure studio_bundle_to_use is not None before accessing is_dev and crashing the app. Now warning message properly displays.

Changelog Description

Small change but if studio_bundle is not initialized & were in dev mode or even not well get a crash.

Additional info

Its 2 line of code... my 1st PR wop wop!

Testing notes:

  1. start new ayon server
  2. create nothing
  3. start laucher - crash.

…nd crashing the app. Now warning message properly displays.
Copilot AI review requested due to automatic review settings March 5, 2026 21:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Prevents an AttributeError crash in the distribution bundle-selection flow when the server returns no studio bundle (e.g., fresh server with no bundles), by guarding access to is_dev on studio_bundle_to_use.

Changes:

  • Cache studio_bundle_to_use in a local variable inside project_bundle_to_use.
  • Add a None guard before accessing studio_bundle.is_dev.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1771 to +1773
studio_bundle = self.studio_bundle_to_use
if studio_bundle and studio_bundle.is_dev:
self._project_bundle = studio_bundle
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

Add a regression test to cover the crash scenario this change fixes (when studio_bundle_to_use resolves to None, e.g. empty bundles list on a fresh server). Without a test, it’s easy to reintroduce an AttributeError by accessing is_dev on None again.

Copilot uses AI. Check for mistakes.
@BigRoy BigRoy requested a review from iLLiCiTiT March 5, 2026 22:24
@BigRoy BigRoy added type: bug Something isn't working community Issues and PRs coming from the community members labels Mar 5, 2026
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
@iLLiCiTiT iLLiCiTiT merged commit 8aef7ce into ynput:develop Mar 6, 2026
1 check passed
@iLLiCiTiT
Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Issues and PRs coming from the community members type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants