# type: handle the 0-length array case in abiSizeAdvanced · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/e7bf143b364f004a76e86cad5fd3256fa87761e4)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: e7bf143b364f004a76e86cad5fd3256fa87761e4

Requested commit: e7bf143b364f004a76e86cad5fd3256fa87761e4

Commit: e7bf143b364f004a76e86cad5fd3256fa87761e4

Tree: 2732efe1bc7912c7ef10578213e2d529318bedcd

Author: kcbanner

Committer: Andrew Kelley

## Message

```
type: handle the 0-length array case in abiSizeAdvanced

This fixes a panic in `unionAbiSize` when a 0-length array of a union is used as a struct field.

Because `resolveTypeLayout` does not resolve the `elem_ty` if `arrayLenIncludingSentinel` returns
0 for the array, the child union type is not guaranteed to have a resolved layout at this point.

Fixed this case by just returning 0 here.

```

## Parents

- [8fab4f98c4ee511ba56fec2f38e2d80535c327a9](https://git.cafe/gitcafe/zig/commit/8fab4f98c4ee511ba56fec2f38e2d80535c327a9?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/e7bf143b364f004a76e86cad5fd3256fa87761e4?format=markdown)
