Skip to content

Conversation

@RytoEX
Copy link
Member

@RytoEX RytoEX commented Mar 21, 2025

Description

When OBS Studio is started in Studio Mode, if a scene collection was not successfully found and loaded, the OBS Frontend API would, prior to obsproject/obs-studio@577e350, emit OBS_FRONTEND_EVENT_SCENE_CHANGED and
OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED anyway. This would result in currentScene here being a nullptr, causing a crash.

For completeness, check for nullptr here so that we cannot crash if obs_frontend_get_current_scene() returns a nullptr.

Motivation and Context

obsproject/obs-studio#11897
obsproject/obs-studio@577e350

How Has This Been Tested?

Tested OS(s):

I haven't personally tested this, but this change was discussed while reviewing obsproject/obs-studio#11897.

Types of changes

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

Checklist:

  • I have read the Contributing Guidelines.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • My code is not on master or a release/* branch.
  • The code has been tested.
  • I have included updates to all appropriate documentation.

When OBS Studio is started in Studio Mode, if a scene collection was not
successfully found and loaded, the OBS Frontend API would, prior to
obsproject/obs-studio@577e350,
emit OBS_FRONTEND_EVENT_SCENE_CHANGED and
OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED anyway. This would result in
currentScene here being a nullptr, causing a crash.

For completeness, check for nullptr here so that we cannot crash if
obs_frontend_get_current_scene() returns a nullptr.
@RytoEX RytoEX requested a review from tt2468 March 21, 2025 19:28
@tt2468 tt2468 merged commit 05e13b1 into obsproject:master Mar 21, 2025
1 check passed
@RytoEX RytoEX deleted the fix-crash-on-null-current-scene branch March 21, 2025 19:38
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