Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic on null in texture UV indices of a CompositeSurface #14

Open
balazsdukai opened this issue Oct 1, 2024 · 0 comments
Open

panic on null in texture UV indices of a CompositeSurface #14

balazsdukai opened this issue Oct 1, 2024 · 0 comments

Comments

@balazsdukai
Copy link
Member

If one of the UV indices in a ring of a CompositeSurface texture is null, cjval panics. This only happens if the other UV indices in the same ring are not null.

This file panics:
cjfake_invalid_0_copy.json
But if you change the null in L31 to 1, the file is valid. Note that having a null for the whole ring is fine, like in case of the first surface.

"values": [
    [[null]],
    [[0, null, 0, 0, 0, 1], [0, 0, 0, 2, 1, 0, 1], [2, 2, 2, 0, 0, 0, 2, 2, 1]]
]

The cause of the panic is the unwrap in

cjval/src/lib.rs

Line 1491 in afeb6e3

if each.unwrap() > (max_i_v - 1) {
. The problem in case of this file is that only the first item in the array is checked for having a value in

cjval/src/lib.rs

Line 1482 in afeb6e3

if y.len() > 1 && y[0].is_some() {
, hence the first surface is handled correctly, but if the null is hidden in the ring, cjval tries to unwrap a None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant