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

Fix NPEs in a few places #1073

Merged
merged 2 commits into from
Nov 1, 2021
Merged

Fix NPEs in a few places #1073

merged 2 commits into from
Nov 1, 2021

Conversation

gbrail
Copy link
Collaborator

@gbrail gbrail commented Oct 22, 2021

This fixes problems with null "this" parameters in:

Function.prototype.call
Function.prototype.apply
Function.prototype.toString
Object.prototype.toLocaleString

This addresses all but one of the NPEs in:

Closes #988

This fixes problems with null "this" parameters in:

Function.prototype.call
Function.prototype.apply
Function.prototype.toString
Object.prototype.toLocaleString

This addresses all but one of the NPEs in:

#988
@p-bakker
Copy link
Collaborator

Looks good to me!

@@ -4367,7 +4369,8 @@ public static Scriptable newObjectLiteral(
Context cx,
Scriptable scope) {
Scriptable object = cx.newObject(scope);
for (int i = 0, end = propertyIds.length; i != end; ++i) {
int idCount = propertyIds == null ? 0 : propertyIds.length;
for (int i = 0, end = idCount; i != end; ++i) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess we can simplify this like

end = propertyIds == null ? 0 : propertyIds.length;
for (int i = 0; i != end; ++i) {

@gbrail gbrail merged commit 2937a45 into master Nov 1, 2021
@gbrail gbrail deleted the greg-fix-npe branch November 1, 2021 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More nullPointers while running test262
3 participants