diff --git a/pymzml/spec.py b/pymzml/spec.py index db9bc7c..3001e8f 100755 --- a/pymzml/spec.py +++ b/pymzml/spec.py @@ -904,8 +904,9 @@ def scan_time(self): scan_time_ele = self.element.find( ".//*[@accession='MS:1000016']".format(ns=self.ns) ) - self._scan_time = float(scan_time_ele.attrib.get("value")) - self._scan_time_unit = scan_time_ele.get("unitName", "unicorns") + if scan_time_ele is not None: + self._scan_time = float(scan_time_ele.attrib.get("value")) + self._scan_time_unit = scan_time_ele.get("unitName", "unicorns") return self._scan_time, self._scan_time_unit # @property