Commit 49bb5f7a26756ae5ad8f5d65db2e00592918a0c5

Authored by Leandro Santos
1 parent bee2e886
Exists in master

prevent null pointer exception in smile block

Showing 1 changed file with 5 additions and 0 deletions   Show diff stats
lib/serpro_integration_plugin/smile_block.rb
... ... @@ -35,6 +35,11 @@ class SerproIntegrationPlugin::SmileBlock < Block
35 35 collect_sonar_information
36 36 factor = (self.sonar_info[METRIC_COVERAGE] * self.sonar_info[METRIC_SUCCESS_DENSITY]).to_f/1000
37 37 factor
  38 + collect_sonar_information
  39 + factor = 0
  40 + if self.sonar_info[METRIC_COVERAGE] && self.sonar_info[METRIC_SUCCESS_DENSITY]
  41 + factor = (self.sonar_info[METRIC_COVERAGE] * self.sonar_info[METRIC_SUCCESS_DENSITY]).to_f/1000
  42 + end
38 43 end
39 44  
40 45 #FIXME make this test
... ...