diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-08-18 03:03:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-18 03:03:23 +0200 |
commit | d010816ba876bf4f749749e9d7432a843e8a1ff9 (patch) | |
tree | 08e9b4c45c1de2bad5455164cd008b1597db4665 /app/models/favourite.rb | |
parent | 78fa926ed560e6a9738144bec7e152fa42104139 (diff) |
Fix error when trying to update counters for statuses that are gone (#8251)
Diffstat (limited to 'app/models/favourite.rb')
-rw-r--r-- | app/models/favourite.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/favourite.rb b/app/models/favourite.rb index ce7a6a336..17f8c9fa6 100644 --- a/app/models/favourite.rb +++ b/app/models/favourite.rb @@ -32,11 +32,11 @@ class Favourite < ApplicationRecord private def increment_cache_counters - status.increment_count!(:favourites_count) + status&.increment_count!(:favourites_count) end def decrement_cache_counters return if association(:status).loaded? && (status.marked_for_destruction? || status.marked_for_mass_destruction?) - status.decrement_count!(:favourites_count) + status&.decrement_count!(:favourites_count) end end |