File tree Expand file tree Collapse file tree 2 files changed +48
-403
lines changed
main/java/com/itextpdf/kernel/pdf
test/java/com/itextpdf/kernel/pdf Expand file tree Collapse file tree 2 files changed +48
-403
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,18 @@ public boolean isEmpty() {
186
186
}
187
187
188
188
public boolean contains (PdfObject o ) {
189
- return list .contains (o );
189
+ if (list .contains (o ))
190
+ return true ;
191
+ if (o != null ) {
192
+ if (o .getIndirectReference () != null
193
+ && list .contains (o .getIndirectReference ())) {
194
+ return true ;
195
+ } else if (o .isIndirectReference ()
196
+ && list .contains (((PdfIndirectReference ) o ).getRefersTo ())) {
197
+ return true ;
198
+ }
199
+ }
200
+ return false ;
190
201
}
191
202
192
203
/**
@@ -217,7 +228,14 @@ public void add(PdfObject pdfObject) {
217
228
}
218
229
219
230
public void remove (PdfObject o ) {
220
- list .remove (o );
231
+ if (list .remove (o ))
232
+ return ;
233
+ if (o != null ) {
234
+ if (o .getIndirectReference () != null && list .remove (o .getIndirectReference ()))
235
+ return ;
236
+ if (o .isIndirectReference ())
237
+ list .remove (((PdfIndirectReference ) o ).getRefersTo ());
238
+ }
221
239
}
222
240
223
241
/**
You can’t perform that action at this time.
0 commit comments