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

ObjectD opCast fails when casting from null #241

Closed
gnunn1 opened this Issue Apr 16, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@gnunn1
Contributor

gnunn1 commented Apr 16, 2018

I have some code in tilix that loops through parents looking for specific widget, at one point it hits the following line:

parent = cast(Container) parent.getParent();

This results in a segmentation fault when parent.getParent() returns null. Should opCast be smart enough to check for null and then just short circuit the method and return null?

Right now I can protect against it using a null check:

                if (parent.getParent() !is null)
                    parent = cast(Container) parent.getParent();
                else
                    parent = null;

I think the change in opCast was introduced in January, I'm not sure the feature this is tied too is used overly much hence why it may have escaped detection until now.

The original tilix issue is here: gnunn1/tilix#1373

@MikeWey

This comment has been minimized.

Member

MikeWey commented Apr 17, 2018

The opCast should short circuit when thuis is null.

@MikeWey MikeWey closed this in dcecbd6 Apr 17, 2018

@MikeWey

This comment has been minimized.

Member

MikeWey commented Apr 20, 2018

3.8.2 with the opCast fix is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment