Skip to content

Commit

Permalink
Don't use an uninitialized instance variables
Browse files Browse the repository at this point in the history
  • Loading branch information
tfausak committed Sep 10, 2015
1 parent 5647d23 commit 022c3e1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/bugsnag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def configure(config_hash=nil)
require "bugsnag/delay/resque" if configuration.delay_with_resque && defined?(Resque)

# Log that we are ready to rock
@logged_ready = nil unless defined?(@logged_ready)
if configuration.api_key && !@logged_ready
log "Bugsnag exception handler #{VERSION} ready, api_key=#{configuration.api_key}"
@logged_ready = true
Expand Down Expand Up @@ -94,7 +95,8 @@ def debug(message)

# Configuration getters
def configuration
@configuration || LOCK.synchronize { @configuration ||= Bugsnag::Configuration.new }
return @configuration if defined?(@configuration)
LOCK.synchronize { @configuration = Bugsnag::Configuration.new }
end

# Set "per-request" data, temporal data for use in bugsnag middleware
Expand Down
1 change: 1 addition & 0 deletions lib/bugsnag/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def ignore_classes
end

def should_notify?
@notify_release_stages = nil unless defined?(@notify_release_stages)
@release_stage.nil? || @notify_release_stages.nil? || @notify_release_stages.include?(@release_stage)
end

Expand Down
1 change: 1 addition & 0 deletions lib/bugsnag/delivery/thread_queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def deliver(url, body, configuration)

def start_once!
MUTEX.synchronize do
@started = nil unless defined?(@started)
return if @started
@started = true

Expand Down
3 changes: 3 additions & 0 deletions lib/bugsnag/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def severity=(severity)
end

def severity
@severity = nil unless defined?(@severity)
@severity || "warning"
end

Expand All @@ -165,6 +166,7 @@ def grouping_hash=(grouping_hash)
end

def grouping_hash
@grouping_hash = nil unless defined?(@grouping_hash)
@grouping_hash || nil
end

Expand Down Expand Up @@ -226,6 +228,7 @@ def deliver
Bugsnag.log("Notifying #{endpoint} of #{@exceptions.last.class} from api_key #{api_key}")

# Deliver the payload
@delivery_method = nil unless defined?(@delivery_method)
self.class.deliver_exception_payload(endpoint, build_exception_payload, @configuration, @delivery_method)
end
end
Expand Down

0 comments on commit 022c3e1

Please sign in to comment.