Skip to content
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

OverUnderBox ctor may dereference scriptBox parameter if it's null #275

Closed
ygra opened this issue Aug 9, 2020 · 1 comment · Fixed by #276
Closed

OverUnderBox ctor may dereference scriptBox parameter if it's null #275

ygra opened this issue Aug 9, 2020 · 1 comment · Fixed by #276
Assignees
Labels

Comments

@ygra
Copy link
Contributor

ygra commented Aug 9, 2020

Noticed while trying to add C# 8 nullability information:

            this.Height = baseBox.Height + (over ? delimeterBox.Width : 0) +
                (over && scriptBox != null ? scriptBox.Height + scriptBox.Depth + kern : 0);
            this.Depth = baseBox.Depth + (over ? 0 : delimeterBox.Width) +
                (!over && scriptBox == null ? 0 : scriptBox.Height + scriptBox.Depth + kern);

The lower two lines look fishy and the condition may have indended to use || instead, but I can't tell for sure.

@ForNeVeR ForNeVeR self-assigned this Aug 9, 2020
@ForNeVeR
Copy link
Owner

ForNeVeR commented Aug 9, 2020

Thanks! This is, indeed, a bug. Fortunately though, OverUnderBox itself doesn't seem to be used much across the code: most of the usages are supposed to come from PredefinedTexFormulas.xml via reflection, and it never calls the methods that generate OverUnderBoxes.

This will be fixed by #276.

ForNeVeR added a commit that referenced this issue Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants