From: Nick Burch Date: Thu, 29 Mar 2007 11:50:50 +0000 (+0000) Subject: Don't NPE if we have a reference to a note, where there's no core record to go with... X-Git-Tag: REL_3_0_RC3~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3ad3a22fd533582b63d82c43f5cb945a6927d59c;p=poi.git Don't NPE if we have a reference to a note, where there's no core record to go with that note's RefID. Instead, just log it, and pretend the note wasn't there. git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@523678 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java index 400eecdc33..fdecb2bb04 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java @@ -273,8 +273,13 @@ public class SlideShow private Record getCoreRecordForRefID(int refID) { Integer coreRecordId = (Integer) _sheetIdToCoreRecordsLookup.get(new Integer(refID)); - Record r = _mostRecentCoreRecords[coreRecordId.intValue()]; - return r; + if(coreRecordId != null) { + Record r = _mostRecentCoreRecords[coreRecordId.intValue()]; + return r; + } else { + logger.log(POILogger.ERROR, "We tried to look up a reference to a core record, but there was no core ID for reference ID " + refID); + return null; + } } /** @@ -352,23 +357,26 @@ public class SlideShow } else { // Match up the records and the SlideAtomSets notesSets = notesSLWT.getSlideAtomsSets(); - notesRecords = new org.apache.poi.hslf.record.Notes[notesSets.length]; + ArrayList notesRecordsL = new ArrayList(); for(int i=0; i