diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-04-19 23:18:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-04-19 23:18:00 +0200 |
commit | 71637b33465433b98b2d4835ba3709b9c7d4744c (patch) | |
tree | f534640b89bae9f8e2387516183de98bfbb6149c /scripts | |
parent | 4833d4fc12d57cde9d0b70ff60ff6417b722b38d (diff) | |
download | context-71637b33465433b98b2d4835ba3709b9c7d4744c.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 | ||||
-rwxr-xr-x | 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 100755 --- 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 |