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 {
1024
1024
public:
1025
1025
1026
1026
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
+
1027
1031
switch (typeRef->getKind ()) {
1028
1032
#define TYPEREF (Id, Parent ) \
1029
1033
case TypeRefKind::Id: \
@@ -1033,7 +1037,9 @@ class TypeRefVisitor {
1033
1037
#include " swift/Reflection/TypeRefs.def"
1034
1038
}
1035
1039
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 ();
1037
1043
}
1038
1044
};
1039
1045
You can’t perform that action at this time.
0 commit comments