Skip to content

Commit

Permalink
Avoid NPE from serie.getFirstDatasetFileForCurrentSerie()
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkain committed Oct 20, 2023
1 parent 1280e83 commit f05f38c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,11 @@ public void setSequenceName(String sequenceName) {

public DatasetFile getFirstDatasetFileForCurrentSerie() {
if (getDatasets() == null
|| getDatasets().get(0) == null
|| getDatasets().get(0).getExpressionFormats() == null
|| getDatasets().get(0).getExpressionFormats().get(0) == null
|| getDatasets().get(0).getExpressionFormats().get(0).getDatasetFiles() == null) {
|| getDatasets().get(0) == null
|| getDatasets().get(0).getExpressionFormats() == null
|| getDatasets().get(0).getExpressionFormats().get(0) == null
|| getDatasets().get(0).getExpressionFormats().get(0).getDatasetFiles() == null
|| getDatasets().get(0).getExpressionFormats().get(0).getDatasetFiles().get(0) == null) {
return null;
}
return getDatasets().get(0).getExpressionFormats().get(0).getDatasetFiles().get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private Set<DatasetAcquisition> generateAcquisitions(Examination examination, Im
try {
dicomAttributes = dicomProcessing.getDicomObjectAttributes(serie.getFirstDatasetFileForCurrentSerie(), serie.getIsEnhanced());
} catch (IOException e) {
throw new ShanoirException("Unable to retrieve dicom attributes in file " + serie.getFirstDatasetFileForCurrentSerie().getPath(), e);
throw new ShanoirException("Unable to retrieve dicom attributes in serie: " + serie.getSeriesDescription(), e);
}

// Generate acquisition object with all sub objects : datasets, protocols, expressions, ...
Expand Down

0 comments on commit f05f38c

Please sign in to comment.