Adding exception handling
diff --git a/src/chat-policy-rule.cpp b/src/chat-policy-rule.cpp
index 201cf70..76d0cf1 100644
--- a/src/chat-policy-rule.cpp
+++ b/src/chat-policy-rule.cpp
@@ -36,7 +36,15 @@
 bool 
 ChatPolicyRule::matchSignerName(const Data & data)
 { 
-  Ptr<const signature::Sha256WithRsa> sigPtr = DynamicCast<const signature::Sha256WithRsa> (data.getSignature());
+  Ptr<const Signature> sig = data.getSignature();
+
+  if(NULL == sig)
+    return false;
+
+  Ptr<const signature::Sha256WithRsa> sigPtr = DynamicCast<const signature::Sha256WithRsa> (sig);
+  if(KeyLocator::KEYNAME != sigPtr->getKeyLocator().getType())
+    return false;
+
   Name signerName = sigPtr->getKeyLocator ().getKeyName ();
   return m_signerRegex->match(signerName); 
 }