Fix: CustomData crash in debug builds with empty name

Due to a recent change the name of a layer is passed using a string ref
but the check if it is filled was done by checking if the first char
was zero. This fails as string ref first does the bound checks.

This is fixed by using `!is_empty()`. There might be more places, but this
one fired when loading production files.

Issue introduced by a39e8a4ab9

Pull Request: https://projects.blender.org/blender/blender/pulls/118605
This commit is contained in:
Jeroen Bakker 2024-02-22 18:01:06 +01:00 committed by Hans Goudey
parent 77cba3d551
commit 17842d4d40
1 changed files with 1 additions and 1 deletions

View File

@ -4593,7 +4593,7 @@ void CustomData_validate_layer_name(const CustomData *data,
int index = -1;
/* if a layer name was given, try to find that layer */
if (name[0]) {
if (!name.is_empty()) {
index = CustomData_get_named_layer_index(data, type, name);
}