diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-02-16 09:39:21 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-02-16 09:50:16 +0000 |
commit | bd7759e0e0e3ac40668adc2f21df13ebc13598e7 (patch) | |
tree | 88e21cf57309241accdf6416bf5a93952b95183d /xmerge | |
parent | 7e6696672c416453f1daf796fef1890603c14b17 (diff) |
coverity#1326257 Dereference after null check
Change-Id: I6159d6a9be17ceaffaa3e3a905abf87a8cf434ed
Diffstat (limited to 'xmerge')
-rw-r--r-- | xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java index 9fe83a2a4a51..7fb3efe2b853 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java @@ -315,6 +315,10 @@ public abstract class OfficeDocument } } + if (embeddedObjects == null) { + return null; + } + return embeddedObjects.values().iterator(); } @@ -566,11 +570,13 @@ public abstract class OfficeDocument // The EmbeddedObjects come first. Iterator<EmbeddedObject> embObjs = getEmbeddedObjects(); - while (embObjs.hasNext()) { - EmbeddedObject obj = embObjs.next(); - obj.writeManifestData(manifestDoc); + if (embObjs != null) { + while (embObjs.hasNext()) { + EmbeddedObject obj = embObjs.next(); + obj.writeManifestData(manifestDoc); - obj.write(zip); + obj.write(zip); + } } // Add in the entry for the Pictures directory. Always present. |