diff --git a/core/modules/parsers/wikiparser/rules/table.js b/core/modules/parsers/wikiparser/rules/table.js index df8f69738..c5c39f5a0 100644 --- a/core/modules/parsers/wikiparser/rules/table.js +++ b/core/modules/parsers/wikiparser/rules/table.js @@ -61,9 +61,9 @@ var processRow = function(prevColumns) { } else if(cellMatch[2]) { // End of row if(prevCell && colSpanCount > 1) { - try { - colSpanCount += prevCell.attributes.colspan.value; - } catch(e) { + if(prevCell.attributes && prevCell.attributes && prevCell.attributes.colspan) { + colSpanCount += prevCell.attributes.colspan.value; + } else { colSpanCount -= 1; } $tw.utils.addAttributeToParseTreeNode(prevCell,"colspan",colSpanCount); diff --git a/core/modules/utils/parsetree.js b/core/modules/utils/parsetree.js index d21659c22..123ca011b 100644 --- a/core/modules/utils/parsetree.js +++ b/core/modules/utils/parsetree.js @@ -20,7 +20,7 @@ exports.addAttributeToParseTreeNode = function(node,name,value) { }; exports.getAttributeValueFromParseTreeNode = function(node,name,defaultValue) { - if(node.type === "element" && node.attributes && node.attributes[name] && node.attributes[name].value != undefined) { + if(node.type === "element" && node.attributes && node.attributes[name] && node.attributes[name].value !== undefined) { return node.attributes[name].value; } return defaultValue;