diff options
author | Marius <mariausol@gmail.com> | 2012-04-20 00:40:13 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-04-20 00:40:13 +0300 |
commit | 959400a677b3eb6ff6513a750be6dde943e62c36 (patch) | |
tree | 91e6f0884f2b018acd879276f1c976440b7c835b /scripts | |
parent | 0756a263c41de5279fef717c5b9cca9909308c3a (diff) | |
download | context-959400a677b3eb6ff6513a750be6dde943e62c36.tar.gz |
beta 2012.04.19 23:18
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 14 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 14 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 14 |
3 files changed, 39 insertions, 3 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 diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 87d5c4460..8f098c1e3 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/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 diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 87d5c4460..8f098c1e3 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -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 |