Skip to content

Commit

Permalink
Ignore elements that are invalid from parsing, see phetsims/studio#213
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Apr 16, 2021
1 parent a0ccdf0 commit d23db3c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions js/nodes/RichText.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,13 +740,15 @@ class RichText extends Node {
sceneryLog && sceneryLog.RichText && sceneryLog.pop();
}

const wasAdded = containerNode.addElement( node );
if ( !wasAdded ) {
// Remove it from the linkItems if we didn't actually add it.
this._linkItems = this._linkItems.filter( item => item.node !== node );

// And since we won't dispose it (since it's not a child), clean it here
node.clean();
if ( node ) {
const wasAdded = containerNode.addElement( node );
if ( !wasAdded ) {
// Remove it from the linkItems if we didn't actually add it.
this._linkItems = this._linkItems.filter( item => item.node !== node );

// And since we won't dispose it (since it's not a child), clean it here
node.clean();
}
}

return lineBreakState;
Expand Down

0 comments on commit d23db3c

Please sign in to comment.