]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5007 Fix display when no active rules
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 19 Jun 2014 16:07:24 +0000 (18:07 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 19 Jun 2014 16:13:05 +0000 (18:13 +0200)
sonar-server/src/main/webapp/WEB-INF/app/helpers/profiles_helper.rb

index 280eaf1331d6791a5ff71a3dea85e6032c9fc71e..ccb40eecbb24bb5488ed478e897eb22eb11ff876 100644 (file)
@@ -24,7 +24,7 @@ module ProfilesHelper
   end
 
   def label_for_rules_count(qProfile, all_profile_stats)
-    profile_stat = all_profile_stats[qProfile.key()]
+    profile_stat = all_profile_stats[qProfile.key()] if all_profile_stats
     profile_rules_count = profile_rules_count(qProfile, profile_stat)
     label = "#{profile_rules_count} #{message('rules').downcase}"
 
@@ -64,6 +64,6 @@ module ProfilesHelper
 
   def overriding_rules_count(profile_stat)
     inheritance_stats = Hash[ *profile_stat.get('inheritance').collect { |v| [ v.getKey(), v ] }.flatten ] if profile_stat
-    inheritance_stats['OVERRIDES'].getValue().to_i if inheritance_stats['OVERRIDES']
+    inheritance_stats['OVERRIDES'].getValue().to_i if inheritance_stats && inheritance_stats['OVERRIDES']
   end
 end