Jump to content

removeShadowCaster null exception


Hersir
 Share

Recommended Posts

Hi,

found case that can trigger null pointer for removeShadowCaster, (possibly addShadowCaster as well).

As includeDescendants is true by default it tries to remove shadow from children as well, but _children array can be null.

if (includeDescendants) {
   // mesh.getChildren() can be null 
   for (var child of mesh.getChildren()) {
      this.removeShadowCaster(<any>child);
   }
}

So one version is to make check before:

var children = mesh.getChildren();
if (includeDescendants && children) {
   for (var child of children) {
      this.removeShadowCaster(<any>child);
   }
}

Same issue is on addShadowCaster as it tries to push children in the list

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...