Skip to content

Commit

Permalink
Fixed bug "TypeError: Cannot read property 'forEach' of null" when cl…
Browse files Browse the repository at this point in the history
…icking on a transaction hash
  • Loading branch information
danielnovy committed Sep 1, 2017
1 parent e7dce50 commit b66e50c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions routes/tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,18 @@ router.get('/:tx', function(req, res, next) {
tx.traces = [];
tx.failed = false;
tx.gasUsed = 0;
if (traces != null) {
traces.forEach(function(trace) {
tx.traces.push(trace);
if (trace.error) {
tx.failed = true;
tx.error = trace.error;
}
if (trace.result && trace.result.gasUsed) {
tx.gasUsed += parseInt(trace.result.gasUsed, 16);
}
});
tx.traces.push(trace);
if (trace.error) {
tx.failed = true;
tx.error = trace.error;
}
if (trace.result && trace.result.gasUsed) {
tx.gasUsed += parseInt(trace.result.gasUsed, 16);
}
});
}
// console.log(tx.traces);

res.render('tx', { tx: tx });
Expand Down

0 comments on commit b66e50c

Please sign in to comment.