From 031a933bb66ff8a24fa719e57861b09830ba26fd Mon Sep 17 00:00:00 2001 From: Zachary Rickards Date: Sat, 26 Feb 2022 16:54:37 -0500 Subject: [PATCH] If new coloum set is shorter than previous default sorted column, the project crashes (#492) --- src/material-table.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/material-table.js b/src/material-table.js index 3fb97906..b5f70730 100644 --- a/src/material-table.js +++ b/src/material-table.js @@ -141,7 +141,7 @@ export default class MaterialTable extends React.Component { (a) => a.defaultSort && a.sorting !== false ); prevSortDirection = - prevSortColumnIndex > -1 + prevSortColumnIndex > -1 && props.columns[prevSortColumnIndex] ? props.columns[prevSortColumnIndex].defaultSort : ''; }