Check if cell have parser to catch undefined error

If you have a table with more table rows than header rows, or use
colspan in the table head then it will fail to find a parser, giving us
a runtime error.
This commit is contained in:
Anders Antila 2014-03-17 15:40:20 +01:00
parent 694357cd2e
commit 3a8666f0b6

View File

@ -296,6 +296,12 @@
}
tc.cache[k].row.push(c);
for (j = 0; j < totalCells; ++j) {
if (typeof parsers[j] === 'undefined') {
if (tc.debug) {
log('No parser found for cell:', c[0].cells[j], 'does it have a header?');
}
continue;
}
t = getElementText(table, c[0].cells[j], j);
// allow parsing if the string is empty, previously parsing would change it to zero,
// in case the parser needs to extract data from the table cell attributes