Fix undefined method for Nil class error.

Fix undefined method for Nil class error.

diff --git a/app/jobs/concerns/alert_post_mixin.rb b/app/jobs/concerns/alert_post_mixin.rb
index f15973b..f22218e 100644
--- a/app/jobs/concerns/alert_post_mixin.rb
+++ b/app/jobs/concerns/alert_post_mixin.rb
@@ -146,7 +146,7 @@ module AlertPostMixin
   end
 
   def get_grafana_dashboard_url(alert, grafana_url)
-    return if grafana_url.blank?
+    return if alert.blank? || grafana_url.blank?
 
     dashboard_path = alert.dig('annotations', 'grafana_dashboard_path')
     return if dashboard_path.blank?

GitHub sha: 1386b7d7

1 Like