diff --git a/src/modules/presence/presentity.c b/src/modules/presence/presentity.c index 785c58546df..497bfa95eaa 100644 --- a/src/modules/presence/presentity.c +++ b/src/modules/presence/presentity.c @@ -734,17 +734,18 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body, goto error; } } + if (presentity->event->evp->type == EVENT_DIALOG) { + check_if_dialog(*body, &is_dialog, &dialog_id); + if (dialog_id) { + if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) { + free(dialog_id); + dialog_id = NULL; + goto error; + } - check_if_dialog(*body, &is_dialog, &dialog_id); - if ( dialog_id ) { - if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) { free(dialog_id); dialog_id = NULL; - goto error; } - - free(dialog_id); - dialog_id = NULL; } LM_DBG("inserting %d cols into table\n",n_query_cols);