summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/table.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsmartcols/src/table.c')
-rw-r--r--libsmartcols/src/table.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c
index e4f27a916..944c1e593 100644
--- a/libsmartcols/src/table.c
+++ b/libsmartcols/src/table.c
@@ -225,6 +225,9 @@ int scols_table_add_column(struct libscols_table *tb, struct libscols_column *cl
if (!tb || !cl || cl->table)
return -EINVAL;
+ if (!list_empty(&cl->cl_columns))
+ return -EINVAL;
+
if (cl->flags & SCOLS_FL_TREE)
tb->ntreecols++;
@@ -594,6 +597,9 @@ int scols_table_add_line(struct libscols_table *tb, struct libscols_line *ln)
if (!tb || !ln)
return -EINVAL;
+ if (!list_empty(&ln->ln_lines))
+ return -EINVAL;
+
if (tb->ncols > ln->ncells) {
int rc = scols_line_alloc_cells(ln, tb->ncols);
if (rc)