What Aspose.Slides API to Extract Speaker Notes from PPTX and PPT in Java?

I used the code below to extract Speaker Notes, I don’t understand well on this statement (NotesSlide) slide.getNotesSlideManager().getNotesSlide();
on some slide, there is no speaker note, but it returns some values. However, on other slides, there is no speaker note, it returns null. Why it works differently?

My Aspose.Slide version is 22.6


Presentation pres = new Presentation(pptFilePath);
for (int i = 0; i < pres.getSlides().size(); i++) {
    ISlide slide = pres.getSlides().get_Item(i);
    NotesSlide notesSlide = (NotesSlide) slide.getNotesSlideManager().getNotesSlide();
    if(notesSlide!=null) {
        String speakerNotes = notesSlide.getNotesTextFrame().getText();
        if (!speakerNotes.isEmpty() || !speakerNotes.isBlank()) {
            pagesWithNote.add(i);
        }
    }
}

@bing.liu,
Thank you for contacting support.

Could you please share the presentation file with which you are having the described issue?