diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 5444a08673499ef0165f73602c6fad1659205082..d4f4653875158f8a5657ed8c27d41b79adefe738 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -7329,12 +7329,8 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi
 			ast_uri_decode(referdata->replaces_callid);
 			if ((ptr = strchr(referdata->replaces_callid, ';'))) 	/* Remove options */ {
 				*ptr = '\0';
+				ptr++;
 			}
-			/*
-			 * XXX don't know what was the intention but this code is
-			 * definitely wrong, as ptr can be NULL here.
-			 */
-			ptr++;
 
 			/* Find the different tags before we destroy the string */
 			to = strcasestr(ptr, "to-tag=");