Merge pull request #9851 from eeckstein/fix-kp-demangling

diff --git a/lib/Demangling/Demangler.cpp b/lib/Demangling/Demangler.cpp
index 03869ed..0bd7278 100644
--- a/lib/Demangling/Demangler.cpp
+++ b/lib/Demangling/Demangler.cpp
@@ -1263,7 +1263,8 @@
                                : Node::Kind::KeyPathSetterThunkHelper;
       auto type = popNode();
       auto sigOrDecl = popNode();
-      if (sigOrDecl->getKind() == Node::Kind::DependentGenericSignature) {
+      if (sigOrDecl &&
+          sigOrDecl->getKind() == Node::Kind::DependentGenericSignature) {
         auto decl = popNode();
         return createWithChildren(nodeKind, decl, sigOrDecl, type);
       } else {
diff --git a/test/Demangle/Inputs/manglings.txt b/test/Demangle/Inputs/manglings.txt
index f072e3c..3b462b1 100644
--- a/test/Demangle/Inputs/manglings.txt
+++ b/test/Demangle/Inputs/manglings.txt
@@ -255,4 +255,5 @@
 _T08_ElementQzSbs5Error_pIxxdzo_ABSbsAC_pIxidzo_s26RangeReplaceableCollectionRzABRLClTR ---> {T:} reabstraction thunk helper <A where A: Swift.RangeReplaceableCollection, A._Element: AnyObject> from @callee_owned (@owned A._Element) -> (@unowned Swift.Bool, @error @owned Swift.Error) to @callee_owned (@in A._Element) -> (@unowned Swift.Bool, @error @owned Swift.Error)
 _T0Ix_IyB_Tr ---> {T:} reabstraction thunk from @callee_owned () -> () to @callee_unowned @convention(block) () -> ()
 _T0Rml ---> _T0Rml
+_T0Tk ---> _T0Tk