From 1dde90ecdc1edae96669362c340d616c3166ba96 Mon Sep 17 00:00:00 2001 From: Tallys Martins Date: Tue, 15 Dec 2015 15:26:36 -0200 Subject: [PATCH] Fix statistic block crash on profile template --- src/noosfero-spb/software_communities/lib/statistic_block.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/noosfero-spb/software_communities/lib/statistic_block.rb b/src/noosfero-spb/software_communities/lib/statistic_block.rb index 54648cf..fe96ea2 100644 --- a/src/noosfero-spb/software_communities/lib/statistic_block.rb +++ b/src/noosfero-spb/software_communities/lib/statistic_block.rb @@ -55,8 +55,13 @@ class StatisticBlock < Block def get_software_statistics statistics = {} software = SoftwareInfo.find_by_community_id(self.owner.id) - statistics[:saved_resources] = software.saved_resources - statistics[:benefited_people] = software.benefited_people + if software.present? + statistics[:saved_resources] = software.saved_resources + statistics[:benefited_people] = software.benefited_people + else + statistics[:saved_resources] = 0 + statistics[:benefited_people] = 0 + end statistics end end -- libgit2 0.21.2