Procházet zdrojové kódy

core: parser - catch special header types for get_hdr()

Daniel-Constantin Mierla před 3 roky
rodič
revize
f9a38d6b62
1 změnil soubory, kde provedl 5 přidání a 1 odebrání
  1. 5 1
      src/core/parser/msg_parser.c

+ 5 - 1
src/core/parser/msg_parser.c

@@ -1012,10 +1012,14 @@ hdr_field_t* get_hdr(const sip_msg_t* const msg, const enum _hdr_types_t ht)
 {
 	hdr_field_t *hdr;
 
-	if (msg->parsed_flag & HDR_T2F(ht))
+	if (ht == HDR_ERROR_T || ht == HDR_EOH_T) {
+		return NULL;
+	}
+	if (msg->parsed_flag & HDR_T2F(ht)) {
 		for(hdr = msg->headers; hdr; hdr = hdr->next) {
 			if(hdr->type == ht) return hdr;
 		}
+	}
 	return NULL;
 }