Commit 1845429268364e75bffdeb1075de8f1606e157ec
1 parent
45b18365
Exists in
master
and in
4 other branches
Use try for commit prev_commit_id detection
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
app/models/commit.rb
@@ -120,10 +120,10 @@ class Commit | @@ -120,10 +120,10 @@ class Commit | ||
120 | end | 120 | end |
121 | 121 | ||
122 | def prev_commit | 122 | def prev_commit |
123 | - parents.first | 123 | + parents.try :first |
124 | end | 124 | end |
125 | 125 | ||
126 | def prev_commit_id | 126 | def prev_commit_id |
127 | - prev_commit.id | 127 | + prev_commit.try :id |
128 | end | 128 | end |
129 | end | 129 | end |