Skip to content

Commit 88a3ee4

Browse files
committed
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. (cherry picked from commit 05e13b1)
1 parent 63e04d2 commit 88a3ee4

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)