RED-7080: Fixed NPE in OCGWatermark removal

This commit is contained in:
deiflaender 2023-08-14 16:31:38 +02:00
parent a462911b64
commit 8d06304723

View File

@ -28,12 +28,14 @@ public class OCGWatermarkRemovalService {
@SneakyThrows @SneakyThrows
private boolean hasOCGWatermarks(PDFDoc pdfDoc) { private boolean hasOCGWatermarks(PDFDoc pdfDoc) {
Obj ocgs = pdfDoc.getOCGs(); Obj ocgs = pdfDoc.getOCGs();
if(ocgs != null) {
for (int i = 0; i < ocgs.size(); i++) { for (int i = 0; i < ocgs.size(); i++) {
Group group = new Group(ocgs.getAt(i)); Group group = new Group(ocgs.getAt(i));
if (group.isValid() && group.getName().equals("Watermark")) { if (group.isValid() && group.getName().equals("Watermark")) {
return true; return true;
} }
} }
}
return false; return false;
} }