Skip to content

Commit

Permalink
Add assert for failed getBucketForElement().
Browse files Browse the repository at this point in the history
  • Loading branch information
Denz1994 committed Mar 9, 2020
1 parent 75a45ad commit 5104eb3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/common/model/Kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,11 @@ class Kit {
* @returns {Bucket}
*/
getBucketForElement( element ) {
//TODO: Add assert for failed _find()
return _.find( this.buckets, bucket => {
const elementBucket = _.find( this.buckets, bucket => {
return bucket.element.isSameElement( element );
} );
assert && assert( elementBucket !== null, 'Element does not have an associated bucket.' );
return elementBucket
}

/**
Expand Down

0 comments on commit 5104eb3

Please sign in to comment.