Skip to content

Commit

Permalink
Merge pull request #2 from quizlet/aw-nan
Browse files Browse the repository at this point in the history
Refuse to process if originalWidth or originalHeight are NaN
  • Loading branch information
malte-wessel committed Mar 22, 2016
2 parents 80ca104 + 649a44a commit 1f7e5e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Textfit.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ export default createClass({
const originalWidth = innerWidth(el);
const originalHeight = innerHeight(el);

if (originalHeight <= 0) {
if (originalHeight <= 0 || isNaN(originalHeight)) {
console.warn('Can not process element without height. Make sure the element is displayed and has a static height.');
return;
}

if (originalWidth <= 0) {
if (originalWidth <= 0 || isNaN(originalWidth)) {
console.warn('Can not process element without width. Make sure the element is displayed and has a static width.');
return;
}
Expand Down

0 comments on commit 1f7e5e7

Please sign in to comment.