Skip to content

Int64 operators crash when null #12387

@Nestorboy

Description

@Nestorboy

The Int64 class is supported using two backing Ints, and when performing operators, it needs to access those two backing Ints. However, none of the operators do any form of null checking and this leads to crashes when Int64 is nullable. Int32 differs in this regard, since it ends up treating null as 0. Here's just one of many examples where this issue occurs:

final i:Int64 = 123;
final n:Int64 = null;
trace(i == n); // TypeError: can't access property "high", n is null

final i:Int32 = 123;
final n:Int32 = null;
trace(i == n); // false

I can't find any information about this behaviour, but I'm assuming this is a bug since the behaviour doesn't coincide with Int32 or Int and can lead to weird gotchas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions