From a9346f1356c1ebd601f5d9859de0dd6c209d321f Mon Sep 17 00:00:00 2001 From: Ashish Kulkarni Date: Fri, 20 Jan 2023 11:25:25 +0530 Subject: [PATCH] fix crash with RuboCop >= 1.41.0 when there are no corrections https://github.com/rubocop/rubocop/pull/11264 did optimisations to not set RuboCop::Cop::Base::InvestigationReport#corrector when there are no corrections. --- lib/pronto/rubocop/offense_line.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pronto/rubocop/offense_line.rb b/lib/pronto/rubocop/offense_line.rb index 9b2007b..6474469 100644 --- a/lib/pronto/rubocop/offense_line.rb +++ b/lib/pronto/rubocop/offense_line.rb @@ -34,6 +34,7 @@ def message_text def suggestion_text return unless patch_cop.runner.pronto_rubocop_config['suggestions'] return if corrections_count.zero? + return if corrector.nil? # possible after optimisation in https://github.com/rubocop/rubocop/pull/11264 return if differing_lines_count != corrections_count @suggestion_text ||= corrected_lines[offense.line - 1]