From f2cae49cab7014f6aa94d7bae2825c47189c8c2c Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Fri, 6 May 2011 17:57:41 +0200 Subject: [PATCH] b/f: don't try to skip lines in empty SDP --- core/AmB2BSession.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp index 97fd6e57..684b0a70 100644 --- a/core/AmB2BSession.cpp +++ b/core/AmB2BSession.cpp @@ -528,14 +528,16 @@ void AmB2BSession::saveSessionDescription(const string& content_type, const char* cmp_body_begin = body.c_str(); size_t cmp_body_length = body.length(); - if (content_type == SIP_APPLICATION_SDP) { - // for SDP, skip v and o line - // (o might change even if SDP unchanged) + #define skip_line \ while (cmp_body_length-- && *cmp_body_begin != '\n') \ cmp_body_begin++; \ cmp_body_begin++; \ + if (body.length() && content_type == SIP_APPLICATION_SDP) { + // for SDP, skip v and o line + // (o might change even if SDP unchanged) + skip_line; skip_line; } @@ -547,7 +549,7 @@ bool AmB2BSession::updateSessionDescription(const string& content_type, const string& body) { const char* cmp_body_begin = body.c_str(); size_t cmp_body_length = body.length(); - if (content_type == SIP_APPLICATION_SDP) { + if (body.length() && content_type == SIP_APPLICATION_SDP) { // for SDP, skip v and o line // (o might change even if SDP unchanged) skip_line;