Skip to content

Fix GUI crash when opening a file before the media player is ready - #794

Open
AlySerry0 wants to merge 1 commit into
Syncplay:masterfrom
AlySerry0:fix/gui-crash-on-null-player
Open

Fix GUI crash when opening a file before the media player is ready#794
AlySerry0 wants to merge 1 commit into
Syncplay:masterfrom
AlySerry0:fix/gui-crash-on-null-player

Conversation

@AlySerry0

@AlySerry0 AlySerry0 commented Aug 11, 2026

Copy link
Copy Markdown

Fixes #787 and #786.

browseMediapath(), OpenAddFilesToPlaylistDialog(), and SyncplayClient.openFile() all touch self._player without checking if it's None. It stays None until the player process actually launches and connects back (SyncplayClient.initPlayer), so opening a file, adding to the playlist, or double-clicking a playlist entry before that happens crashes with:

AttributeError: 'NoneType' object has no attribute 'customOpenDialog'
AttributeError: 'NoneType' object has no attribute 'openFile'

That's guaranteed if the player fails to launch at all (both linked issues), but it can also happen with a working player if you click fast enough right after startup - I hit the openFile one by accident just double-clicking a playlist entry while testing the other two.

Added a playerIsNotReady() check before each one and show a message instead of crashing.

Test plan:

  • Reproduced all three crashes with a player path that always fails to start
  • Confirmed the fix on all three (message shown, no crash) against the same setup
  • Clicked through it manually in the built GUI - Open Media File, Add files to playlist, and double-clicking a playlist entry

@AlySerry0
AlySerry0 force-pushed the fix/gui-crash-on-null-player branch 2 times, most recently from 8f555c5 to cb789a3 Compare August 11, 2026 18:14
browseMediapath(), OpenAddFilesToPlaylistDialog(), and
SyncplayClient.openFile() all dereferenced self._player without
checking it for None. The player stays None until it finishes
launching and connects back to Syncplay (see SyncplayClient.initPlayer),
so any of the following crash if they happen before that:

- opening a file from the File menu
- adding files to the playlist from the File menu
- double-clicking a file already in the playlist (playlistItemClicked
  -> openFile), the same way even with a working player if you click
  fast enough right after startup

All three hit:

    AttributeError: 'NoneType' object has no attribute 'customOpenDialog'
    AttributeError: 'NoneType' object has no attribute 'openFile'

This matches the crashes reported in Syncplay#787 and Syncplay#786. Guard all three call
sites with the existing playerIsNotReady() helper and show a message
instead of crashing.
@AlySerry0
AlySerry0 force-pushed the fix/gui-crash-on-null-player branch from cb789a3 to e135057 Compare August 12, 2026 05:46
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.

SyncPlay won't open media files when using VLC

1 participant