Skip to content

Commit

Permalink
Revert "Request: Minor code cleanup"
Browse files Browse the repository at this point in the history
This reverts commit c16669c.
  • Loading branch information
tt2468 committed Sep 2, 2021
1 parent c16669c commit d7f96b6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/requesthandler/rpc/Request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,27 +143,28 @@ obs_source_t *Request::ValidateScene(const std::string keyName, RequestStatus::R

std::string sceneName = RequestData[keyName];

OBSSourceAutoRelease ret = obs_get_source_by_name(sceneName.c_str());
obs_source_t *ret = obs_get_source_by_name(sceneName.c_str());
if (!ret) {
statusCode = RequestStatus::ResourceNotFound;
comment = std::string("No scene was found by the name of `") + sceneName + "`.";
return nullptr;
}

if (obs_source_get_type(ret) != OBS_SOURCE_TYPE_SCENE) {
obs_source_release(ret);
statusCode = RequestStatus::InvalidResourceType;
comment = "The specified source is not a scene.";
return nullptr;
}

OBSScene scene = obs_scene_from_source(ret);
if (obs_scene_is_group(scene)) {
obs_source_release(ret);
statusCode = RequestStatus::InvalidResourceType;
comment = "The specified source is not a scene.";
return nullptr;
}

obs_source_addref(ret);
return ret;
}

Expand Down

0 comments on commit d7f96b6

Please sign in to comment.