sys-file-reader: Avoid assert-fail for duplicate attribute names.
[pspp] / src / data / sys-file-reader.c
index 6010d77313bb81a23f1442c15e6af808690745d3..8abfe10b689fda6ce24df8c7d916ee3618a37aa7 100644 (file)
@@ -2335,7 +2335,14 @@ parse_attributes (struct sfm_reader *r, struct text_record *text,
             break;
         }
       if (attrs != NULL)
-        attrset_add (attrs, attr);
+        {
+          if (!attrset_try_add (attrs, attr))
+            {
+              text_warn (r, text, _("Duplicate attribute %s."),
+                         attribute_get_name (attr));
+              attribute_destroy (attr);
+            }
+        }
       else
         attribute_destroy (attr);
     }