Skip to content

Commit 05e13b1

Browse files
RytoEXtt2468
authored andcommitted
eventhandler: Fix possible crash on OBS start in Studio Mode
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.
1 parent 4bf9592 commit 05e13b1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/eventhandler/EventHandler_Scenes.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ void EventHandler::HandleCurrentProgramSceneChanged()
109109
{
110110
OBSSourceAutoRelease currentScene = obs_frontend_get_current_scene();
111111

112+
if (!currentScene)
113+
return;
114+
112115
json eventData;
113116
eventData["sceneName"] = obs_source_get_name(currentScene);
114117
eventData["sceneUuid"] = obs_source_get_uuid(currentScene);

0 commit comments

Comments
 (0)