summaryrefslogtreecommitdiff
path: root/tex/context/base/lpdf-ini.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-04-19 17:40:26 +0300
committerMarius <mariausol@gmail.com>2013-04-19 17:40:26 +0300
commitb7e0ad6611d168a628cd644b4c6c7a83788e483a (patch)
tree72c8e0d8fa4899ce271636bfa6da99a3bcf058fa /tex/context/base/lpdf-ini.lua
parent4586560fc032bd763deee980ed5238511be88ba9 (diff)
downloadcontext-b7e0ad6611d168a628cd644b4c6c7a83788e483a.tar.gz
beta 2013.04.19 16:29
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()