[Core] Correctly throw an error when using attach to element id with an invalid id

This commit is contained in:
Nic Barker 2025-04-29 12:31:54 +12:00
parent b33ba4ff62
commit a21b0665fe

2
clay.h
View File

@ -2038,7 +2038,7 @@ void Clay__ConfigureOpenElementPtr(const Clay_ElementDeclaration *declaration) {
}
} else if (declaration->floating.attachTo == CLAY_ATTACH_TO_ELEMENT_WITH_ID) {
Clay_LayoutElementHashMapItem *parentItem = Clay__GetHashMapItem(floatingConfig.parentId);
if (!parentItem) {
if (parentItem == &Clay_LayoutElementHashMapItem_DEFAULT) {
context->errorHandler.errorHandlerFunction(CLAY__INIT(Clay_ErrorData) {
.errorType = CLAY_ERROR_TYPE_FLOATING_CONTAINER_PARENT_NOT_FOUND,
.errorText = CLAY_STRING("A floating element was declared with a parentId, but no element with that ID was found."),