Skip to content

Commit

Permalink
add assertion for soluteGramsProperty #210
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Oct 11, 2017
1 parent 3545505 commit 504827b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/concentration/model/ConcentrationSolution.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ define( function( require ) {
// @public {number} amount of solute, in grams
this.soluteGramsProperty = new DerivedProperty( [ this.soluteProperty, this.soluteAmountProperty, this.precipitateAmountProperty ],
function( solute, soluteAmount, precipitateAmount ) {
return solute.molarMass * ( soluteAmount - precipitateAmount );
var soluteGrams = solute.molarMass * ( soluteAmount - precipitateAmount );
assert && assert( soluteGrams >= 0, 'invalid soluteGrams: ' + soluteGrams );
return soluteGrams;
}, {
tandem: tandem.createTandem( 'soluteGramsProperty' ),
units: 'grams',
Expand Down

0 comments on commit 504827b

Please sign in to comment.