diff --git a/main/utils.c b/main/utils.c
index 6728fce7e1a8ec35c6b5a4229be0dea434a9c68e..dd12009d1ae0a2a94488b82e47648b8eaf7654d0 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -653,7 +653,7 @@ char *ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
 	char *q;
 
 	s = ast_strip(s);
-	if ((q = strchr(beg_quotes, *s))) {
+	if ((q = strchr(beg_quotes, *s)) && *q != '\0') {
 		e = s + strlen(s) - 1;
 		if (*e == *(end_quotes + (q - beg_quotes))) {
 			s++;