Crash when accessing image data

Hello,

I am trying to access image data in Bytes for an image stored at Bundled/. The game compiles and starts. However, it immediately crashes giving no errors in the debug console if run with Krom. The HTML version does not crash, but the data read is a null value.

I am providing the TestFile.blend (588.0 KB) file,
Haxe script: MyTrait.hx (411 Bytes)

and the image used :


Could someone please point out where I am going wrong.

Thank you in advance.

Unless I’m missing something it seems that you have found a bug in Kromx.

The call in getPixels() starts here in Kha: https://github.com/armory3d/Kha/blob/d3467d483db2f4b4a308b91ef1e4cf5e204bd00d/Backends/Krom/kha/Image.hx#L170
to a function called getTexturePixels / krom_get_texture_pixels in Krom/Kromx:
And with a bit of testing I pinpointed the crash to this line: https://github.com/armory3d/Kromx/blob/93c7a3c80ea7aeb820c68d8e5de9ba04c9400a9c/Sources/main.cpp#L1740
It seems that trying to access the Value() produces a crash.

I recommend opening an issue in the Kromx github repo. Also you can try compiling and using a binary build of Krom for the moment from here https://github.com/Kode/Krom to see if it works the feature you need.

Also in HTML5 it returns null because it’s not yet implemented: https://github.com/armory3d/Kha/blob/d3467d483db2f4b4a308b91ef1e4cf5e204bd00d/Backends/HTML5/kha/Image.hx#L139

Update: I opened an issue in the Kromx repo https://github.com/armory3d/Kromx/issues/6

4 Likes