[ASTPrinter] Add missing null check in isNonSendableExtension

The extended nominal may not be present for an invalid extension.

rdar://149032713
This commit is contained in:
Hamish Knight
2025-04-23 15:24:48 +01:00
parent a10356aa27
commit 71be544585
2 changed files with 9 additions and 2 deletions

View File

@@ -2234,8 +2234,11 @@ bool isNonSendableExtension(const Decl *D) {
if (!ED || !ED->isUnavailable())
return false;
auto nonSendable =
ED->getExtendedNominal()->getAttrs().getEffectiveSendableAttr();
auto *NTD = ED->getExtendedNominal();
if (!NTD)
return false;
auto nonSendable = NTD->getAttrs().getEffectiveSendableAttr();
if (!isa_and_nonnull<NonSendableAttr>(nonSendable))
return false;