tingletech/pymarc — comment on commit ee7f4041befa779eb18f817fa629a140d77de11e
File:  line 0
By lawlesst:

I have come across this as well.

Is there any harm in just setting indicators in cases like this to '\\' for undefined? All test pass after this change.

diff --git a/pymarc/record.py b/pymarc/record.py
--- a/pymarc/record.py
+++ b/pymarc/record.py
@@ -176,8 +176,14 @@
else:
subfields = list()
subs = entry_data.split(SUBFIELD_INDICATOR)
- first_indicator = subs[0][0]
- second_indicator = subs[0][1]
+ try:
+ first_indicator = subs[0][0]
+ except IndexError:
+ first_indicator = '\\'
+ try:
+ second_indicator = subs[0][1]
+ except IndexError:
+ first_indicator = '\\'
for subfield in subs[1:]:
if len(subfield) == 0:
continue