Skip zero-length subfields for ISO2709.
[yaz-moved-to-github.git] / src / marc_read_iso2709.c
index 07cd59a..54d8653 100644 (file)
@@ -177,7 +177,8 @@ int yaz_marc_read_iso2709(yaz_marc_t mt, const char *buf, int bsize)
                         buf[i] != ISO2709_RS && buf[i] != ISO2709_IDFS &&
                        buf[i] != ISO2709_FS)
                     i++;
-                yaz_marc_add_subfield(mt, buf+code_offset, i - code_offset);
+                if (i > code_offset)
+                    yaz_marc_add_subfield(mt, buf+code_offset, i - code_offset);
             }
         }
         else