Skip to content

Commit 5a00e83

Browse files
Don't try to populate the PinholeSize if it wasn't parsed
In particular, the pinhole size may be present in the XML, but just hasn't been parsed yet.
1 parent 63bf9ca commit 5a00e83

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

components/formats-gpl/src/loci/formats/in/LeicaHandler.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ public void endElement(String uri, String localName, String qName) {
202202
if (level != MetadataLevel.MINIMUM) {
203203
int nChannels = coreMeta.rgb ? 0 : numChannels;
204204

205-
for (int c=0; c<nChannels; c++) {
206-
store.setChannelPinholeSize(new Length(pinhole, UNITS.MICROMETER), numDatasets, c);
205+
if (pinhole != null) {
206+
for (int c=0; c<nChannels; c++) {
207+
store.setChannelPinholeSize(new Length(pinhole, UNITS.MICROMETER), numDatasets, c);
208+
}
207209
}
208210

209211
for (int i=0; i<xPos.size(); i++) {
@@ -256,8 +258,10 @@ else if (qName.equals("Element") && level != MetadataLevel.MINIMUM) {
256258
String id = MetadataTools.createLSID("Detector", numDatasets, index);
257259
store.setDetectorSettingsID(id, numDatasets, index);
258260
}
259-
for (int c=0; c<nChannels; c++) {
260-
store.setChannelPinholeSize(new Length(pinhole, UNITS.MICROMETER), numDatasets, c);
261+
if (pinhole != null) {
262+
for (int c=0; c<nChannels; c++) {
263+
store.setChannelPinholeSize(new Length(pinhole, UNITS.MICROMETER), numDatasets, c);
264+
}
261265
}
262266
}
263267
}

0 commit comments

Comments
 (0)