summaryrefslogtreecommitdiff
path: root/scripts/context/lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-04-20 00:40:13 +0300
committerMarius <mariausol@gmail.com>2012-04-20 00:40:13 +0300
commit959400a677b3eb6ff6513a750be6dde943e62c36 (patch)
tree91e6f0884f2b018acd879276f1c976440b7c835b /scripts/context/lua
parent0756a263c41de5279fef717c5b9cca9909308c3a (diff)
downloadcontext-959400a677b3eb6ff6513a750be6dde943e62c36.tar.gz
beta 2012.04.19 23:18
Diffstat (limited to 'scripts/context/lua')
-rw-r--r--scripts/context/lua/mtxrun.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 87d5c4460..8f098c1e3 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -7441,7 +7441,7 @@ local grammar_unparsed_text = P { "preamble",
-- maybe we will add settings to result as well
-local function xmlconvert(data, settings)
+local function _xmlconvert_(data, settings)
settings = settings or { } -- no_root strip_cm_and_dt given_entities parent_root error_handler
--
strip = settings.strip_cm_and_dt
@@ -7537,6 +7537,18 @@ local function xmlconvert(data, settings)
return result
end
+-- Because we can have a crash (stack issues) with faulty xml, we wrap this one
+-- in a protector:
+
+function xmlconvert(data,settings)
+ local ok, result = pcall(function() return _xmlconvert_(data,settings) end)
+ if ok then
+ return result
+ else
+ return _xmlconvert_("")
+ end
+end
+
xml.convert = xmlconvert
function xml.inheritedconvert(data,xmldata) -- xmldata is parent