fltk-rs / fl2rust

A fluid (fltk ui designer) file to Rust transpiler
MIT License
52 stars 3 forks source link

index out of bounds: the len is 10 but the index is 18446744073709551615 #15

Closed 1sra3l closed 2 years ago

1sra3l commented 2 years ago

https://github.com/fltk-rs/fl2rust/blob/62e26384b84fb7a782fd4a30093cfb9c611bdec0/src/gen.rs#L177

I think it shoule be

for i in 1..props.len() {
// since you use props[i - 1]
MoAlyousef commented 2 years ago

Hi Do you have a reproducer which invokes this?

MoAlyousef commented 2 years ago

I've pushed a fix which uses optionals and wrapping sub.

1sra3l commented 2 years ago

@MoAlyousef it is still happenening unless I modify to 0 to 1 again. I have tried both using a manual version fl2rust in.fl > out.rs as well as manually editing my installed version and deleting my deps to rebuild the changes.

This is by far the most intricate FLUID file I have ever used with the program, it is 1247 lines, otherwise I'd post it here. If the 0 should work (like it used to) it seems there is likely some item I am using you did not include, or something along those lines.

1sra3l commented 2 years ago

Though, if you just want me to post it anyhow I can :smile:

MoAlyousef commented 2 years ago

Does it also happen with the latest changes? If you could upload it or send it privately, it would provide a good test case.

MoAlyousef commented 2 years ago

I've tried the latest changes on the file you sent me and it seems to work correctly. Can you try again?

MoAlyousef commented 2 years ago

Were you able to verify the latest release?

1sra3l commented 2 years ago

This does indeed fix it! Thanks so much I will close this!