From 018ce16703b4dfc384cbca7e6edec8c5ff03b9fb Mon Sep 17 00:00:00 2001 From: tt2468 Date: Thu, 19 Jan 2023 02:49:15 -0800 Subject: [PATCH] libobs: Fix loading of custom_size for empty scenes Previously, `custom_size` was checked at the end of the `scene_load` function. If the scene contained no "items" array, the `custom_scene` loading code would never be run. This moves the `custom_size` code above the return statement. --- libobs/obs-scene.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libobs/obs-scene.c b/libobs/obs-scene.c index 68490ba30..c5fff5f92 100644 --- a/libobs/obs-scene.c +++ b/libobs/obs-scene.c @@ -1103,6 +1103,12 @@ static void scene_load(void *data, obs_data_t *settings) remove_all_items(scene); + if (obs_data_get_bool(settings, "custom_size")) { + scene->cx = (uint32_t)obs_data_get_int(settings, "cx"); + scene->cy = (uint32_t)obs_data_get_int(settings, "cy"); + scene->custom_size = true; + } + if (!items) return; @@ -1117,12 +1123,6 @@ static void scene_load(void *data, obs_data_t *settings) if (obs_data_has_user_value(settings, "id_counter")) scene->id_counter = obs_data_get_int(settings, "id_counter"); - if (obs_data_get_bool(settings, "custom_size")) { - scene->cx = (uint32_t)obs_data_get_int(settings, "cx"); - scene->cy = (uint32_t)obs_data_get_int(settings, "cy"); - scene->custom_size = true; - } - obs_data_array_release(items); }