Skip to content

Commit 46f387d

Browse files
Merge branch 'zontal' into feature/runtime
2 parents 8530c38 + c3729b9 commit 46f387d

File tree

5 files changed

+721
-519
lines changed

5 files changed

+721
-519
lines changed

RawFileParser.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,25 @@ private static void ProcessFile(ParseInput parseInput)
136136

137137
// Get the number of instruments (controllers) present in the RAW file and set the
138138
// selected instrument to the MS instrument, first instance of it
139-
rawFile.SelectInstrument(Device.MS, 1);
139+
var firstScanNumber = -1;
140+
var lastScanNumber = -1;
141+
if (rawFile.GetInstrumentCountOfType(Device.MS) != 0)
142+
{
143+
rawFile.SelectInstrument(Device.MS, 1);
140144

141-
rawFile.IncludeReferenceAndExceptionData = !parseInput.ExData;
145+
rawFile.IncludeReferenceAndExceptionData = !parseInput.ExData;
142146

143-
// Get the first and last scan from the RAW file
144-
var firstScanNumber = rawFile.RunHeaderEx.FirstSpectrum;
145-
var lastScanNumber = rawFile.RunHeaderEx.LastSpectrum;
147+
// Get the first and last scan from the RAW file
148+
firstScanNumber = rawFile.RunHeaderEx.FirstSpectrum;
149+
lastScanNumber = rawFile.RunHeaderEx.LastSpectrum;
146150

147-
// Check for empty file
148-
if (lastScanNumber < 1)
149-
{
150-
throw new RawFileParserException("Empty RAW file, no output will be produced");
151+
// Check for empty file
152+
if (lastScanNumber < 1)
153+
{
154+
throw new RawFileParserException("Empty RAW file, no output will be produced");
155+
}
151156
}
152-
157+
153158
if (parseInput.MetadataFormat != MetadataFormat.NONE)
154159
{
155160
MetadataWriter metadataWriter = new MetadataWriter(parseInput);

0 commit comments

Comments
 (0)