summaryrefslogtreecommitdiff
path: root/tex/context/base/lpdf-ini.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/lpdf-ini.lua')
-rw-r--r--tex/context/base/lpdf-ini.lua40
1 files changed, 24 insertions, 16 deletions
diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua
index 0b1473d2f..cd601f21f 100644
--- a/tex/context/base/lpdf-ini.lua
+++ b/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()