os/mac/extend/ENV/super: handle nil sdk.

I'm aware this is not meant to happen but: sometimes it does and the
lack of handling produces a subpar error.
This commit is contained in:
Mike McQuaid 2023-02-23 15:31:04 +00:00
parent 68859ae256
commit b3db997e7b
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829

View File

@ -90,9 +90,9 @@ module Superenv
sdk = formula ? MacOS.sdk_for_formula(formula) : MacOS.sdk
is_xcode_sdk = sdk&.source == :xcode
self["HOMEBREW_SDKROOT"] = if is_xcode_sdk || MacOS.sdk_root_needed?
if is_xcode_sdk || MacOS.sdk_root_needed?
Homebrew::Diagnostic.checks(:fatal_setup_build_environment_checks)
sdk.path
self["HOMEBREW_SDKROOT"] = sdk.path if sdk
end
self["HOMEBREW_DEVELOPER_DIR"] = if is_xcode_sdk