From 6f80b4688bce7b391093412def6e65c3b61cbd20 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Wed, 4 May 2016 15:54:01 -0400 Subject: [PATCH] doctor: guard against nil Xcode.version (#197) MacOS::Xcode.version may be nil (when neither Xcode nor CLT are installed), so guard against that where it may happen in `brew doctor`. --- Library/Homebrew/diagnostic.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index d79e540c14..086a68f911 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -416,7 +416,7 @@ module Homebrew end def check_for_osx_gcc_installer - return unless MacOS.version < "10.7" || MacOS::Xcode.version > "4.1" + return unless MacOS.version < "10.7" || ((MacOS::Xcode.version || "0") > "4.1") return unless MacOS.clang_version == "2.1" fix_advice = if MacOS.version >= :mavericks @@ -439,7 +439,7 @@ module Homebrew # if the uninstaller script isn't there, it's a good guess neither are # any troublesome leftover Xcode files uninstaller = Pathname.new("/Developer/Library/uninstall-developer-folder") - return unless MacOS::Xcode.version >= "4.3" && uninstaller.exist? + return unless ((MacOS::Xcode.version || "0") >= "4.3") && uninstaller.exist? <<-EOS.undent You have leftover files from an older version of Xcode.