From 8af475473c6ab876b48552fa418f7fc4d6bdd402 Mon Sep 17 00:00:00 2001 From: Guilherme Gabriel Date: Wed, 4 Aug 2021 09:00:53 -0300 Subject: [PATCH] added trycatch that prevents a critical bug of trying to read properties from undefined --- packages/react-bootstrap-table2/src/body.js | 41 +++++++++++---------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/packages/react-bootstrap-table2/src/body.js b/packages/react-bootstrap-table2/src/body.js index f176bbf80..96267d554 100644 --- a/packages/react-bootstrap-table2/src/body.js +++ b/packages/react-bootstrap-table2/src/body.js @@ -88,25 +88,28 @@ class Body extends React.Component { } content = data.map((row, index) => { - const key = _.get(row, keyField); - const baseRowProps = { - key, - row, - tabIndexCell, - columns, - keyField, - cellEdit, - value: key, - rowIndex: index, - visibleColumnSize, - attrs: rowEvents || {}, - ...additionalRowProps - }; - - baseRowProps.style = _.isFunction(rowStyle) ? rowStyle(row, index) : rowStyle; - baseRowProps.className = (_.isFunction(rowClasses) ? rowClasses(row, index) : rowClasses); - - return ; + try { + const key = _.get(row, keyField); + const baseRowProps = { + key, + row, + tabIndexCell, + columns, + keyField, + cellEdit, + value: key, + rowIndex: index, + visibleColumnSize, + attrs: rowEvents || {}, + ...additionalRowProps + }; + + baseRowProps.style = _.isFunction(rowStyle) ? rowStyle(row, index) : rowStyle; + baseRowProps.className = (_.isFunction(rowClasses) ? rowClasses(row, index) : rowClasses); + + return ; + } catch (error) {} + }); }