diff --git a/js/common/model/SharingModel.ts b/js/common/model/SharingModel.ts index 724762a..b1aa9be 100644 --- a/js/common/model/SharingModel.ts +++ b/js/common/model/SharingModel.ts @@ -287,7 +287,11 @@ export default class SharingModel extends PhetioObject implemen implementation: function( this: SharingModel, dataPoints: number[] ) { // Validate data points - if ( dataPoints.length > this.maxPlatesProperty.value ) { + // If a client passes through an empty array of data points, ignore and return early. + if ( dataPoints.length === 0 ) { + return; + } + else if ( dataPoints.length > this.maxPlatesProperty.value ) { dataPoints = dataPoints.slice( 0, this.maxPlatesProperty.value ); } dataPoints.forEach( ( dataPoint, i ) => { diff --git a/js/level-out/model/LevelOutModel.ts b/js/level-out/model/LevelOutModel.ts index fe008c9..10eea4a 100644 --- a/js/level-out/model/LevelOutModel.ts +++ b/js/level-out/model/LevelOutModel.ts @@ -413,7 +413,11 @@ export default class LevelOutModel extends PhetioObject implements TModel { implementation: function( this: LevelOutModel, dataPoints: number[] ) { // Validate data points - if ( dataPoints.length > this.maxCupsProperty.value ) { + // If a client passes through an empty array of data points, ignore and return early. + if ( dataPoints.length === 0 ) { + return; + } + else if ( dataPoints.length > this.maxCupsProperty.value ) { dataPoints = dataPoints.slice( 0, this.maxCupsProperty.value ); } dataPoints.forEach( ( dataPoint, i ) => {