Skip to content

Commit 7e4dd2d

Browse files
committed
Dont’ add initial vote unless idea was successfully created
1 parent b2132d6 commit 7e4dd2d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

factory/ideas.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,10 @@ public function submit($data)
741741
$idea_id = $this->insert_idea_data($sql_ary, $this->table_ideas);
742742

743743
// Initial vote
744-
$idea = $this->get_idea($idea_id);
745-
$this->vote($idea, $data['poster_id'], 1);
744+
if (($idea = $this->get_idea($idea_id)) !== false)
745+
{
746+
$this->vote($idea, $data['poster_id'], 1);
747+
}
746748

747749
return $idea_id;
748750
}

0 commit comments

Comments
 (0)