1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Fix NodePath::slice() incorrect behavior for subname indexing

Adjust slice boundaries in `NodePath` logic to correctly handle subnames.
Update test cases to reflect these changes.
This commit is contained in:
Jan Haller
2024-12-30 21:22:26 +01:00
parent 2582793d40
commit df66ea74d7
2 changed files with 11 additions and 8 deletions

View File

@@ -255,7 +255,7 @@ NodePath NodePath::slice(int p_begin, int p_end) const {
if (end < 0) {
end += total_count;
}
const int sub_begin = MAX(begin - name_count - 1, 0);
const int sub_begin = MAX(begin - name_count, 0);
const int sub_end = MAX(end - name_count, 0);
const Vector<StringName> names = get_names().slice(begin, end);