Skip to content

Commit 3102c48

Browse files
committed
Null check
1 parent 229e1f0 commit 3102c48

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

Writer/MzMlSpectrumWriter.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,16 +1683,19 @@ private PrecursorListType ConstructPrecursorList(IScanEventBase scanEvent, int?
16831683
if (selectedIonMz > ZeroDelta)
16841684
{
16851685
var selectedIonIntensity = CalculatePrecursorPeakIntensity(_rawFile, precursorScanNumber, selectedIonMz);
1686-
ionCvParams.Add(new CVParamType
1686+
if (selectedIonIntensity != null)
16871687
{
1688-
name = "peak intensity",
1689-
value = selectedIonIntensity.ToString(),
1690-
accession = "MS:1000042",
1691-
cvRef = "MS",
1692-
unitAccession = "MS:1000131",
1693-
unitCvRef = "MS",
1694-
unitName = "number of detector counts"
1695-
});
1688+
ionCvParams.Add(new CVParamType
1689+
{
1690+
name = "peak intensity",
1691+
value = selectedIonIntensity.ToString(),
1692+
accession = "MS:1000042",
1693+
cvRef = "MS",
1694+
unitAccession = "MS:1000131",
1695+
unitCvRef = "MS",
1696+
unitName = "number of detector counts"
1697+
});
1698+
}
16961699
}
16971700

16981701
precursor.selectedIonList.selectedIon[0].cvParam = ionCvParams.ToArray();

0 commit comments

Comments
 (0)