From bc9c3fc9025b8a90c3fe2fa8d75c4ffcaf148c3a Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Thu, 4 Aug 2016 11:32:10 -0700 Subject: [PATCH] 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 --- react-packager/src/Resolver/polyfills/console.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-packager/src/Resolver/polyfills/console.js b/react-packager/src/Resolver/polyfills/console.js index 27efc320..33b853b2 100644 --- a/react-packager/src/Resolver/polyfills/console.js +++ b/react-packager/src/Resolver/polyfills/console.js @@ -422,7 +422,7 @@ function setupConsole(global) { columns.forEach(function(k, i) { columnWidths[i] = k.length; 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][i] = cellStr; columnWidths[i] = Math.max(columnWidths[i], cellStr.length);