diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index 1f0bc03644a4cfce8ee5710e5786843b17a10780..66288d53f605c0e1165b35f468661ff707863c9f 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -1075,6 +1075,10 @@ static void destroy_subscriptions(struct ast_sip_subscription *root)
 {
 	int i;
 
+	if (!root) {
+		return;
+	}
+
 	for (i = 0; i < AST_VECTOR_SIZE(&root->children); ++i) {
 		struct ast_sip_subscription *child;