@@ -1344,10 +1344,10 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
13441344 }
13451345
13461346 //finding precursor scan failed
1347- if ( _precursorScanNumber == - 2 )
1347+ if ( _precursorScanNumber == - 2 || ! _precursorTree . ContainsKey ( _precursorScanNumber ) )
13481348 {
13491349 Log . Warn ( $ "Cannot find precursor scan for scan# { scanNumber } ") ;
1350- _precursorTree [ - 2 ] = new PrecursorInfo ( 0 , msLevel , FindLastReaction ( scanEvent , msLevel ) , new PrecursorType [ 0 ] ) ;
1350+ _precursorTree [ _precursorScanNumber ] = new PrecursorInfo ( 0 , msLevel , FindLastReaction ( scanEvent , msLevel ) , new PrecursorType [ 0 ] ) ;
13511351 ParseInput . NewWarn ( ) ;
13521352 }
13531353
@@ -1494,8 +1494,9 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
14941494 basePeakMass = scan . ScanStatistics . BasePeakMass ;
14951495 basePeakIntensity = scan . ScanStatistics . BasePeakIntensity ;
14961496
1497+ //cannot centroid empty segmented scan
14971498 if ( scan . SegmentedScan . PositionCount > 0 )
1498- {
1499+ {
14991500 // If the spectrum is profile perform centroiding
15001501 var segmentedScan = scanEvent . ScanData == ScanDataType . Profile
15011502 ? Scan . ToCentroid ( scan ) . SegmentedScan
@@ -1547,7 +1548,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
15471548
15481549 basePeakMass = scan . ScanStatistics . BasePeakMass ;
15491550 basePeakIntensity = scan . ScanStatistics . BasePeakIntensity ;
1550-
1551+
15511552 masses = scan . SegmentedScan . Positions ;
15521553 raw_masses = ( double [ ] ) masses . Clone ( ) ;
15531554 intensities = scan . SegmentedScan . Intensities ;
@@ -2616,6 +2617,7 @@ private ScanListType ConstructScanList(int scanNumber, Scan scan, IScanFilter sc
26162617 instrumentConfigurationRef = "IC1" ;
26172618 }
26182619
2620+ // Scan start time & scan filter string
26192621 var scanTypeCvParams = new List < CVParamType >
26202622 {
26212623 new CVParamType
@@ -2635,10 +2637,6 @@ private ScanListType ConstructScanList(int scanNumber, Scan scan, IScanFilter sc
26352637 }
26362638 } ;
26372639
2638- // Scan start time
2639-
2640- // Scan filter string
2641-
26422640 // Ion injection time
26432641 if ( ionInjectionTime . HasValue )
26442642 {
0 commit comments