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