diff --git a/doc/changes/devel/13097.bugfix.rst b/doc/changes/devel/13097.bugfix.rst new file mode 100644 index 00000000000..02500b91027 --- /dev/null +++ b/doc/changes/devel/13097.bugfix.rst @@ -0,0 +1 @@ +Fix bug when loading certain EEGLAB files that do not contain a ``nodatchans`` field, by `Clemens Brunner`_. \ No newline at end of file diff --git a/mne/io/eeglab/eeglab.py b/mne/io/eeglab/eeglab.py index 3aa611b4e28..10e23b811a0 100644 --- a/mne/io/eeglab/eeglab.py +++ b/mne/io/eeglab/eeglab.py @@ -162,7 +162,7 @@ def _get_montage_information(eeg, get_pos, *, montage_units): ) lpa, rpa, nasion = None, None, None - if hasattr(eeg, "chaninfo") and isinstance(eeg.chaninfo["nodatchans"], dict): + if hasattr(eeg, "chaninfo") and isinstance(eeg.chaninfo.get("nodatchans"), dict): nodatchans = eeg.chaninfo["nodatchans"] types = nodatchans.get("type", []) descriptions = nodatchans.get("description", [])