Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pyx12/x12file.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ def _parse_segment(self, seg_data):
X12Base._parse_segment(self, seg_data)
seg_id = seg_data.get_seg_id()
if seg_id == 'IEA':
if not self.loops:
err_str = 'IEA loop with malformed preceding segment'
self._isa_error('000', err_str) # what is the correct code to use?
return # nothing to delete
if self.loops[-1][0] != 'ISA':
# Unterminated GS loop
err_str = 'Unterminated Loop %s' % (self.loops[-1][0])
Expand Down
2 changes: 1 addition & 1 deletion pyx12/x12xml_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def seg(self, seg_node, seg_data):
self.writer.push(xname, attrib)
for i in range(len(seg_data)):
child_node = seg_node.get_child_node_by_idx(i)
if child_node.usage == 'N' or seg_data.get('%02i' % (i + 1)).is_empty():
if child_node is None or child_node.usage == 'N' or seg_data.get('%02i' % (i + 1)).is_empty():
pass # Do not try to ouput for invalid or empty elements
elif child_node.is_composite():
(xname, attrib) = self._get_comp_info(seg_node_id)
Expand Down