File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -527,15 +527,26 @@ class MetadataReader {
527527 // Dig out the protocol from the protocol list.
528528 auto protocolList = readMangledName (resolved.getResolvedAddress (),
529529 MangledNameKind::Type, dem);
530- assert (protocolList->getFirstChild ()
531- ->getFirstChild ()
532- ->getFirstChild ()
533- ->getFirstChild ()
534- ->getKind () == Node::Kind::Protocol);
535- auto protocol = protocolList->getFirstChild ()
536- ->getFirstChild ()
537- ->getFirstChild ()
538- ->getFirstChild ();
530+ assert (protocolList && protocolList->getNumChildren ());
531+ if (!protocolList || !protocolList->getNumChildren ())
532+ return nullptr ;
533+ auto child = protocolList->getFirstChild ();
534+ assert (child && child->getNumChildren ());
535+ if (!child || !child->getNumChildren ())
536+ return nullptr ;
537+ child = child->getFirstChild ();
538+ assert (child && child->getNumChildren ());
539+ if (!child || !child->getNumChildren ())
540+ return nullptr ;
541+ assert (child && child->getNumChildren ());
542+ child = child->getFirstChild ();
543+ if (!child || !child->getNumChildren ())
544+ return nullptr ;
545+ child = child->getFirstChild ();
546+ assert (child && child->getKind () == Node::Kind::Protocol);
547+ if (!child || child->getKind () != Node::Kind::Protocol)
548+ return nullptr ;
549+ auto protocol = child;
539550 auto protocolType = dem.createNode (Node::Kind::Type);
540551 protocolType->addChild (protocol, dem);
541552 return protocolType;
You can’t perform that action at this time.
0 commit comments