mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Bugfix: calling SetPreviewScene with an unknown source doesn't errors
This commit is contained in:
parent
82d74fcb2f
commit
9ddfad99ea
@ -334,7 +334,7 @@ obs_scene_t* Utils::GetPreviewScene()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Utils::SetPreviewScene(const char* name)
|
||||
bool Utils::SetPreviewScene(const char* name)
|
||||
{
|
||||
if (IsPreviewModeActive())
|
||||
{
|
||||
@ -342,7 +342,14 @@ void Utils::SetPreviewScene(const char* name)
|
||||
QList<QListWidgetItem*> matchingItems = sceneList->findItems(name, Qt::MatchExactly);
|
||||
|
||||
if (matchingItems.count() > 0)
|
||||
{
|
||||
sceneList->setCurrentItem(matchingItems.first());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
2
Utils.h
2
Utils.h
@ -59,7 +59,7 @@ class Utils
|
||||
static void TogglePreviewMode();
|
||||
|
||||
static obs_scene_t* GetPreviewScene();
|
||||
static void SetPreviewScene(const char* name);
|
||||
static bool SetPreviewScene(const char* name);
|
||||
static void TransitionToProgram();
|
||||
|
||||
static const char* OBSVersionString();
|
||||
|
@ -943,9 +943,12 @@ void WSRequestHandler::HandleSetPreviewScene(WSRequestHandler *req)
|
||||
}
|
||||
|
||||
const char* scene_name = obs_data_get_string(req->data, "scene-name");
|
||||
Utils::SetPreviewScene(scene_name);
|
||||
bool success = Utils::SetPreviewScene(scene_name);
|
||||
|
||||
req->SendOKResponse();
|
||||
if (success)
|
||||
req->SendOKResponse();
|
||||
else
|
||||
req->SendErrorResponse("specified scene doesn't exist");
|
||||
}
|
||||
|
||||
void WSRequestHandler::HandleTransitionToProgram(WSRequestHandler *req)
|
||||
|
Loading…
x
Reference in New Issue
Block a user