mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -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:
parent
0583331bfd
commit
d55bb6bc86
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user