mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-18 20:28:01 +00:00
Don't divide zero by zero
This commit is contained in:
parent
814c9392c6
commit
3319603ae1
5
clay.h
5
clay.h
@ -2141,7 +2141,10 @@ void Clay__CompressChildrenAlongAxis(bool xAxis, float totalSizeToDistribute, Cl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
targetSize = CLAY__MAX(targetSize, (largestSize * largestContainers.length) - totalSizeToDistribute) / largestContainers.length;
|
if (largestContainers.length > 0) {
|
||||||
|
targetSize = CLAY__MAX(targetSize, (largestSize * largestContainers.length) - totalSizeToDistribute) / largestContainers.length;
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t childOffset = 0; childOffset < largestContainers.length; childOffset++) {
|
for (int32_t childOffset = 0; childOffset < largestContainers.length; childOffset++) {
|
||||||
Clay_LayoutElement *childElement = Clay_LayoutElementArray_Get(&context->layoutElements, Clay__int32_tArray_Get(&largestContainers, childOffset));
|
Clay_LayoutElement *childElement = Clay_LayoutElementArray_Get(&context->layoutElements, Clay__int32_tArray_Get(&largestContainers, childOffset));
|
||||||
float *childSize = xAxis ? &childElement->dimensions.width : &childElement->dimensions.height;
|
float *childSize = xAxis ? &childElement->dimensions.width : &childElement->dimensions.height;
|
||||||
|
Loading…
Reference in New Issue
Block a user