summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/lpdf-ini.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/lpdf-ini.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/lpdf-ini.lua40
1 files changed, 24 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/context/base/lpdf-ini.lua b/Master/texmf-dist/tex/context/base/lpdf-ini.lua
index 0b1473d2f93..cd601f21f4b 100644
--- a/Master/texmf-dist/tex/context/base/lpdf-ini.lua
+++ b/Master/texmf-dist/tex/context/base/lpdf-ini.lua
@@ -451,28 +451,36 @@ end
local shareobjectcache, shareobjectreferencecache = { }, { }
function lpdf.shareobject(content)
- content = tostring(content)
- local o = shareobjectcache[content]
- if not o then
- o = pdfimmediateobject(content)
- shareobjectcache[content] = o
- end
- return o
-end
-
-function lpdf.shareobjectreference(content)
- content = tostring(content)
- local r = shareobjectreferencecache[content]
- if not r then
+ if content == nil then
+ -- invalid object not created
+ else
+ content = tostring(content)
local o = shareobjectcache[content]
if not o then
o = pdfimmediateobject(content)
shareobjectcache[content] = o
end
- r = pdfreference(o)
- shareobjectreferencecache[content] = r
+ return o
+ end
+end
+
+function lpdf.shareobjectreference(content)
+ if content == nil then
+ -- invalid object not created
+ else
+ content = tostring(content)
+ local r = shareobjectreferencecache[content]
+ if not r then
+ local o = shareobjectcache[content]
+ if not o then
+ o = pdfimmediateobject(content)
+ shareobjectcache[content] = o
+ end
+ r = pdfreference(o)
+ shareobjectreferencecache[content] = r
+ end
+ return r
end
- return r
end
--~ local d = lpdf.dictionary()