Skip to content

Cyberpunk: skip crash message without main window - #241

Open
Sekers wants to merge 1 commit into
ModOrganizer2:masterfrom
Sekers:cyberpunk-crash-message-without-ui
Open

Sekers wants to merge 1 commit into
ModOrganizer2:masterfrom
Sekers:cyberpunk-crash-message-without-ui

Conversation

@Sekers

@Sekers Sekers commented Oct 29, 2026

Copy link
Copy Markdown

When MO2 runs Cyberpunk from the command line or a desktop shortcut while MO2 is closed (run -e or moshortcut://), it never opens its main window, so _on_user_interface_initialized never sets _parentWidget. If the game then exits with a nonzero code, _onFinishedRun raises:

AttributeError: 'Cyberpunk2077Game' object has no attribute '_parentWidget'

This change defaults _parentWidget to None and skips the crash message when it's None. In these runs MO2 exits as soon as the game ends, so the message couldn't stay open anyway. Runs from MO2's window are unchanged.

Tested on MO2 2.5.2 with Cyberpunk 2077 2.5 (Steam), ending the game with taskkill /F (exit code 1):

Started with Before After
run -e, MO2 closed "Failed to run 'Cyberpunk 2077'" error with the AttributeError; MO2 stays open MO2 exits with code 0
moshortcut://, MO2 closed MO2 exits with code 1 and shows nothing MO2 exits with code 0
MO2's Run button Crash message Crash message (unchanged)

ruff check, ruff format --check, and pyright pass.

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.

1 participant