--- a/modules/presence_dialoginfo/notify_body.c
+++ b/modules/presence_dialoginfo/notify_body.c
@@ -74,8 +74,10 @@
 	LM_DBG("[pres_user]=%.*s [pres_domain]= %.*s, [n]=%d\n",
 			pres_user->len, pres_user->s, pres_domain->len, pres_domain->s, n);
 
-	if(body_array== NULL)
-		return NULL;
+	if(body_array== NULL) {
+		n = 0; /* just to be safe */
+		/* return NULL; */
+        }
 
 	n_body= agregate_xmls(pres_user, pres_domain, body_array, n);
 	LM_DBG("[n_body]=%p\n", n_body);
@@ -125,13 +127,17 @@
 	LM_DBG("[pres_user]=%.*s [pres_domain]= %.*s, [n]=%d\n",
 			pres_user->len, pres_user->s, pres_domain->len, pres_domain->s, n);
 
-	xml_array = (xmlDocPtr*)pkg_malloc( n*sizeof(xmlDocPtr));
-	if(xml_array== NULL)
+        if (n > 0)
 	{
-		LM_ERR("while allocating memory");
-		return NULL;
+		xml_array = (xmlDocPtr*)pkg_malloc( n*sizeof(xmlDocPtr));
+		if(xml_array== NULL)
+		{
+			LM_ERR("while allocating memory");
+			return NULL;
+		}
+		memset(xml_array, 0, n*sizeof(xmlDocPtr)) ;
 	}
-	memset(xml_array, 0, n*sizeof(xmlDocPtr)) ;
+	else xml_array = NULL;
 
 	/* parse all the XML documents */
 	for(i=0; i<n; i++)
@@ -152,14 +158,14 @@
 		j++;
 
 	} 
-
+#if 0
 	if(j== 0)  /* no body */
 	{
 		if(xml_array)
 			pkg_free(xml_array);
 		return NULL;
 	}
-
+#endif
 	/* n: number of bodies in total */
 	/* j: number of useful bodies; created XML structures */
 	/* i: loop counter */
