diff --git a/lib/CMTD/Helpers.pm b/lib/CMTD/Helpers.pm index 659ad3c..90b7a75 100644 --- a/lib/CMTD/Helpers.pm +++ b/lib/CMTD/Helpers.pm @@ -125,10 +125,10 @@ sub register { my ($c, $pid, $cm) = @_; my $table = 'comments'; $c->app->db->begin; - my $seq = $c->app->db->select($table, 'max(seq)', {pid => $pid})->list; + my $seq = $c->app->db->select($table, 'max(seq)', {pid => $pid})->list || 0; $c->app->db->insert($table, { pid => $pid, - seq => $seq, + seq => $seq + 1, date => time(), name => $cm->{name}, reply => $cm->{reply},