HaxeFoundation / HaxeFoundation/haxe

[cpp] Cast from a null typed Array to Array<Dynamic> results in an empty array

Open
#6,170 4 comments 0 reactions 0 assignees View on GitHub
platform-cpp
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

We had a really odd game-breaking bug reported after shipping an update using 3.4.0 (and since repeated using 3.4.2 and HXCPP 3.4.64) which we tracked down to the behaviour demonstrated in the following example:
```
var test:Array = null;
var test2:Array = test;
trace(test2);
```
Resulting in test2 being an empty array rather than null (which the code relied on).
```
Main.hx:6: []
```
We worked around the issue and released updates, so it's not an emergency, but this doesn't seem right to me.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.