Skip to content

Commit

Permalink
Fix possible NULL pointer dereference (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
peter15914 authored Jan 4, 2025
1 parent cf12cd6 commit bcb555f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clay.h
Original file line number Diff line number Diff line change
Expand Up @@ -1842,12 +1842,13 @@ void Clay__ElementPostConfiguration(void) {
}
} else {
Clay_LayoutElementHashMapItem *parentItem = Clay__GetHashMapItem(floatingConfig->parentId);
clipElementId = Clay__int32_tArray_Get(&Clay__layoutElementClipElementIds, (int32_t)(parentItem->layoutElement - Clay__layoutElements.internalArray));
if (!parentItem) {
Clay__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."),
.userData = Clay__errorHandler.userData });
} else {
clipElementId = Clay__int32_tArray_Get(&Clay__layoutElementClipElementIds, parentItem->layoutElement - Clay__layoutElements.internalArray);
}
}
Clay__LayoutElementTreeRootArray_Add(&Clay__layoutElementTreeRoots, CLAY__INIT(Clay__LayoutElementTreeRoot) {
Expand Down

0 comments on commit bcb555f

Please sign in to comment.