File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1024,6 +1024,10 @@ class TypeRefVisitor {
10241024public:
10251025
10261026 RetTy visit (const TypeRef *typeRef, Args... args) {
1027+ // We shouldn't get a NULL typeRef, but handle it gracefully if we do.
1028+ if (!typeRef)
1029+ return RetTy ();
1030+
10271031 switch (typeRef->getKind ()) {
10281032#define TYPEREF (Id, Parent ) \
10291033 case TypeRefKind::Id: \
@@ -1033,7 +1037,9 @@ class TypeRefVisitor {
10331037#include " swift/Reflection/TypeRefs.def"
10341038 }
10351039
1036- swift_unreachable (" Unhandled TypeRefKind in switch." );
1040+ // We shouldn't get an unknown kind, but bad data might result in an unknown
1041+ // value showing up here. Handle it gracefully when that happens.
1042+ return RetTy ();
10371043 }
10381044};
10391045
You can’t perform that action at this time.
0 commit comments