From 4f6a849a59089597d63d0a50cb6446cc1e509505 Mon Sep 17 00:00:00 2001 From: reviewher <24845478+reviewher@users.noreply.github.com> Date: Tue, 1 Mar 2022 04:14:41 -0500 Subject: [PATCH] simplify rels scan (fixes #2537) --- bits/31_rels.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bits/31_rels.js b/bits/31_rels.js index faf3e89..cefad7b 100644 --- a/bits/31_rels.js +++ b/bits/31_rels.js @@ -61,7 +61,9 @@ var RELS_EXTERN = [RELS.HLINK, RELS.XPATH, RELS.XMISS]; function add_rels(rels, rId/*:number*/, f, type, relobj, targetmode/*:?string*/)/*:number*/ { if(!relobj) relobj = {}; if(!rels['!id']) rels['!id'] = {}; - if(rId < 0) for(rId = 1; rels['!id']['rId' + rId]; ++rId){/* empty */} + if(!rels['!idx']) rels['!idx'] = 1; + if(rId < 0) for(rId = rels['!idx']; rels['!id']['rId' + rId]; ++rId){/* empty */} + rels['!idx'] = rId + 1; relobj.Id = 'rId' + rId; relobj.Type = type; relobj.Target = f;