diff options
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 |