Added better error handling to address issue
@@ -316,16 +316,23 @@ public class SiriusExportTask extends AbstractTask {
* precursorScan.getMassList(massListName).getDataPoints() :
* precursorScan.getDataPoints()); } } }
*/ // Do not include MS1 scans (except for isotope pattern)
+ MassList massList = scan.getMassList(massListName);
+ if (massList == null) {
+ setStatus(TaskStatus.ERROR);
+ String msg = "Scan " + f.getDataFile().getName() + "#" + scan.getScanNumber() + " does not have a mass list named " + massListName;
+ setErrorMessage(msg);
+ return;
+ }
if (mergeMsMs == SiriusExportParameters.MERGE_MODE.NO_MERGE) {
writeHeader(writer, row, f.getDataFile(), polarity, MsType.MSMS,
scan.getScanNumber());
writeSpectrum(writer,
- massListName != null ? scan.getMassList(massListName).getDataPoints()
+ massListName != null ? massList.getDataPoints()
: scan.getDataPoints());
} else {
if (mergeMsMs == SiriusExportParameters.MERGE_MODE.MERGE_OVER_SAMPLES)
sources.add(f.getDataFile().getName());
- toMerge.add(massListName != null ? scan.getMassList(massListName).getDataPoints()
+ toMerge.add(massListName != null ? massList.getDataPoints()
: scan.getDataPoints());
}
}
