mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-13 04:37:14 -05:00
Fall back to obs_frontend_get_current_scene()
If there wasn't any scene change yet GetCurrentScene() would always return nullptr and break various scene checks. For example, this could happen when startup up a fresh OBS install for the first time.
This commit is contained in:
@@ -199,7 +199,17 @@ std::chrono::high_resolution_clock::time_point GetLastSceneChangeTime()
|
||||
|
||||
OBSWeakSource GetCurrentScene()
|
||||
{
|
||||
return switcher->currentScene;
|
||||
if (switcher->currentScene) {
|
||||
return switcher->currentScene;
|
||||
}
|
||||
|
||||
// If there wasn't any scene switch yet switcher->currentScene will be
|
||||
// null and we must use obs_frontend_get_current_scene() instead
|
||||
OBSSourceAutoRelease currentSceneSource =
|
||||
obs_frontend_get_current_scene();
|
||||
OBSWeakSourceAutoRelease currentSceneWeakSource =
|
||||
obs_source_get_weak_source(currentSceneSource);
|
||||
return currentSceneWeakSource.Get();
|
||||
}
|
||||
|
||||
OBSWeakSource GetPreviousScene()
|
||||
|
||||
Reference in New Issue
Block a user