Skip to content

Commit

Permalink
Guard for color unlink, see phetsims/sun#362
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Jun 21, 2018
1 parent fe05f84 commit d466379
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/display/SVGGradientStop.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ define( function( require ) {

if ( color instanceof Property ) {
sceneryLog && sceneryLog.Paints && sceneryLog.Paints( '[SVGGradientStop] removing Property listener: ' + this.svgGradient.gradient.id + ' : ' + this.ratio );
color.unlink( this.propertyListener );
if ( color.hasListener( this.propertyListener ) ) {
color.unlink( this.propertyListener );
}
if ( color.value instanceof Color ) {
sceneryLog && sceneryLog.Paints && sceneryLog.Paints( '[SVGGradientStop] removing Color listener: ' + this.svgGradient.gradient.id + ' : ' + this.ratio );
color.value.changeEmitter.removeListener( this.colorListener );
Expand Down

0 comments on commit d466379

Please sign in to comment.