Skip to content

Commit

Permalink
Fixed broken endless loop
Browse files Browse the repository at this point in the history
  • Loading branch information
fvdm committed Feb 29, 2016
1 parent 8b0defa commit 193e61e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fibonacci.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function startIteration (limit) {
var result = {};
var limitResult = {};

limit = new bignum (limit);
limit = limit && new bignum (limit);
module.exports.doWhile = true;

while (module.exports.doWhile) {
Expand All @@ -49,7 +49,7 @@ function startIteration (limit) {
module.exports.emit ('result', result);

// found the one
if (loop.eq (limit)) {
if (limit && loop.eq (limit)) {
module.exports.doWhile = false;
module.exports.emit ('done', result);
return result;
Expand Down

0 comments on commit 193e61e

Please sign in to comment.