fix console.table polyfill when entries are missing

Summary: Looks like react-addons-perf is sometimes missing entries. This prevents it from crashing.

Reviewed By: davidaurelio

Differential Revision: D3669007

fbshipit-source-id: 18a1102b5ad8dcfd9b80d39e1172ba85ad0e9dd2
This commit is contained in:
Spencer Ahrens 2016-08-04 11:32:10 -07:00 committed by Facebook Github Bot 8
parent 341b29da71
commit 0dd93b62b4
1 changed files with 1 additions and 1 deletions

View File

@ -422,7 +422,7 @@ function setupConsole(global) {
columns.forEach(function(k, i) { columns.forEach(function(k, i) {
columnWidths[i] = k.length; columnWidths[i] = k.length;
for (var j = 0; j < rows.length; j++) { for (var j = 0; j < rows.length; j++) {
var cellStr = rows[j][k].toString(); var cellStr = (rows[j][k] || '?').toString();
stringRows[j] = stringRows[j] || []; stringRows[j] = stringRows[j] || [];
stringRows[j][i] = cellStr; stringRows[j][i] = cellStr;
columnWidths[i] = Math.max(columnWidths[i], cellStr.length); columnWidths[i] = Math.max(columnWidths[i], cellStr.length);