diff --git a/src/pylsl/info.py b/src/pylsl/info.py index ad089fb..001b91a 100644 --- a/src/pylsl/info.py +++ b/src/pylsl/info.py @@ -319,10 +319,10 @@ def get_channel_units(self) -> typing.Optional[list[typing.Optional[str]]]: def _get_channel_info(self, name) -> typing.Optional[list[typing.Optional[str]]]: """Get the 'channel/name' element in the XML tree.""" - if self.desc().child("channels").empty(): + channels = self.desc().child("channels") + if channels.empty(): return None ch_infos = list() - channels = self.desc().child("channels") ch = channels.child("channel") while not ch.empty(): ch_info = ch.child(name).first_child().value()