summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Davis <ryand-ruby@zenspider.com>2019-06-05 18:58:08 -0700
committerRyan Davis <ryand-ruby@zenspider.com>2019-06-05 18:58:08 -0700
commitba8904c71357ddda0e18d95f3184307cd52be710 (patch)
tree859cf3905443b1d757f8080b978780e21983b14a
parent7e9373f5dd41a9ac258102df01f45bed8467f2f9 (diff)
downloadmixlib-log-ba8904c71357ddda0e18d95f3184307cd52be710.tar.gz
Check for the existence of the ivar before accessing it.
Makes the code run nearly warning free, reducing the output of `rspec -w spec` by 42 lines. That has to mean something, right? Signed-off-by: Ryan Davis <zenspider@chef.io>
-rw-r--r--lib/mixlib/log.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/mixlib/log.rb b/lib/mixlib/log.rb
index 491bbc8..18cdfd3 100644
--- a/lib/mixlib/log.rb
+++ b/lib/mixlib/log.rb
@@ -190,6 +190,7 @@ module Mixlib
# via public API. In order to reduce amount of impact and
# handle only File type log devices I had to use this method
# to get access to it.
+ next unless logger.instance_variable_defined?(:"@logdev")
next unless (logdev = logger.instance_variable_get(:"@logdev"))
loggers_to_close << logger if logdev.filename
end