diff --git a/CMakeLists.txt b/CMakeLists.txt index 32765964..f435efeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16...3.25) -set(obs-websocket_VERSION 5.5.4) +set(obs-websocket_VERSION 5.5.6) set(OBS_WEBSOCKET_RPC_VERSION 1) include(cmake/obs-websocket-api.cmake) diff --git a/src/eventhandler/EventHandler_Scenes.cpp b/src/eventhandler/EventHandler_Scenes.cpp index 9dc22110..b8dcdf6e 100644 --- a/src/eventhandler/EventHandler_Scenes.cpp +++ b/src/eventhandler/EventHandler_Scenes.cpp @@ -109,6 +109,9 @@ void EventHandler::HandleCurrentProgramSceneChanged() { OBSSourceAutoRelease currentScene = obs_frontend_get_current_scene(); + if (!currentScene) + return; + json eventData; eventData["sceneName"] = obs_source_get_name(currentScene); eventData["sceneUuid"] = obs_source_get_uuid(currentScene); diff --git a/src/utils/Json.cpp b/src/utils/Json.cpp index 68f05881..923020a4 100644 --- a/src/utils/Json.cpp +++ b/src/utils/Json.cpp @@ -178,7 +178,7 @@ json Utils::Json::ObsDataToJson(obs_data_t *d, bool includeDefault) bool Utils::Json::GetJsonFileContent(std::string fileName, json &content) { - std::ifstream f(fileName); + std::ifstream f(std::filesystem::u8path(fileName)); if (!f.is_open()) return false; @@ -195,9 +195,11 @@ bool Utils::Json::GetJsonFileContent(std::string fileName, json &content) bool Utils::Json::SetJsonFileContent(std::string fileName, const json &content, bool makeDirs) { + auto jsonFilePath = std::filesystem::u8path(fileName); + if (makeDirs) { + auto p = jsonFilePath.parent_path(); std::error_code ec; - auto p = std::filesystem::path(fileName).parent_path(); if (!ec && !std::filesystem::exists(p, ec)) std::filesystem::create_directories(p, ec); if (ec) { @@ -207,7 +209,7 @@ bool Utils::Json::SetJsonFileContent(std::string fileName, const json &content, } } - std::ofstream f(fileName); + std::ofstream f(jsonFilePath); if (!f.is_open()) { blog(LOG_ERROR, "[Utils::Json::SetJsonFileContent] Failed to open file `%s` for writing", fileName.c_str()); return false;