mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-27 02:42:26 -04:00
frontend: Prevent creation of scene collections with empty name
Empty names for scene collections are not allowed, but this constraint is only enforced by UI code during text input. Thus frontend API users are able to create valid scene collections with empty names which will lead to later possible crashes as the scene collection is malformed. As the frontend API uses the related function CreateNewSceneCollection which handles exceptions by this method, no crashes should occur when an empty string is provided by an API caller.
This commit is contained in:
@@ -83,6 +83,10 @@ void cleanBackupCollision(const OBSSceneCollection &collection)
|
||||
|
||||
void OBSBasic::SetupNewSceneCollection(const std::string &collectionName)
|
||||
{
|
||||
if (collectionName.empty()) {
|
||||
throw std::logic_error("Cannot create new scene collection with empty collection name");
|
||||
}
|
||||
|
||||
const OBSSceneCollection &newCollection = CreateSceneCollection(collectionName);
|
||||
|
||||
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);
|
||||
|
||||
Reference in New Issue
Block a user