Commit 1dde90ecdc1edae96669362c340d616c3166ba96

Authored by Tallys Martins
1 parent 407f3753

Fix statistic block crash on profile template

Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
src/noosfero-spb/software_communities/lib/statistic_block.rb
... ... @@ -55,8 +55,13 @@ class StatisticBlock &lt; Block
55 55 def get_software_statistics
56 56 statistics = {}
57 57 software = SoftwareInfo.find_by_community_id(self.owner.id)
58   - statistics[:saved_resources] = software.saved_resources
59   - statistics[:benefited_people] = software.benefited_people
  58 + if software.present?
  59 + statistics[:saved_resources] = software.saved_resources
  60 + statistics[:benefited_people] = software.benefited_people
  61 + else
  62 + statistics[:saved_resources] = 0
  63 + statistics[:benefited_people] = 0
  64 + end
60 65 statistics
61 66 end
62 67 end
... ...