From a19945b53a8d37244a599f3afd44f473853c3ee6 Mon Sep 17 00:00:00 2001 From: Ilya Melamed Date: Fri, 21 Mar 2025 17:56:47 +0200 Subject: [PATCH] libobs: Fix setting non-0 order on only scene item --- libobs/obs-scene.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libobs/obs-scene.c b/libobs/obs-scene.c index 83dc7e66b..516929e84 100644 --- a/libobs/obs-scene.c +++ b/libobs/obs-scene.c @@ -2908,7 +2908,6 @@ void obs_sceneitem_set_order_position(obs_sceneitem_t *item, int position) return; struct obs_scene *scene = obs_scene_get_ref(item->parent); - struct obs_scene_item *next; if (!scene) return; @@ -2916,11 +2915,12 @@ void obs_sceneitem_set_order_position(obs_sceneitem_t *item, int position) full_lock(scene); detach_sceneitem(item); - next = scene->first_item; - if (position == 0) { + if (!scene->first_item || position == 0) { attach_sceneitem(scene, item, NULL); } else { + struct obs_scene_item *next = scene->first_item; + for (int i = position; i > 1; --i) { if (next->next == NULL) break;