From 65d48727ffa522385112284bbc264d060782ddd6 Mon Sep 17 00:00:00 2001 From: Mottie Date: Thu, 14 May 2015 11:54:39 -0500 Subject: [PATCH] Core: prevent js error if sortList targets incorrect column. Fixes #908 --- js/jquery.tablesorter.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index b9a79da2..876fce6f 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -639,9 +639,10 @@ val = sortList[indx]; // ensure all sortList values are numeric - fixes #127 col = parseInt(val[0], 10); - // make sure header exists - header = c.$headerIndexed[col][0]; - if (header) { // prevents error if sorton array is wrong + // prevents error if sorton array is wrong + if ( col < c.columns && c.$headerIndexed[col] ) { + // make sure header exists + header = c.$headerIndexed[col][0]; // o.count = o.count + 1; dir = ('' + val[1]).match(/^(1|d|s|o|n)/); dir = dir ? dir[0] : '';