[vlc-commits] dash: Avoid crashing when there's no SegmentInfo node.

Hugo Beauzée-Luyssen git at videolan.org
Mon Nov 28 20:24:31 CET 2011


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Nov 28 13:29:03 2011 +0100| [8c55fe50c102c71ca2e62b3c75d19eee918387ea] | committer: Jean-Baptiste Kempf

dash: Avoid crashing when there's no SegmentInfo node.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8c55fe50c102c71ca2e62b3c75d19eee918387ea
---

 modules/stream_filter/dash/mpd/BasicCMParser.cpp |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
index c1aea0d..dd88fe0 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
@@ -96,11 +96,15 @@ void    BasicCMParser::setSegmentInfo       (Node *root, Representation *rep)
 {
     Node    *segmentInfo = DOMHelper::getFirstChildElementByName( root, "SegmentInfo");
 
-    SegmentInfo *info = new SegmentInfo( segmentInfo->getAttributes() );
-    this->setInitSegment( segmentInfo, info );
-    this->setSegments(segmentInfo, info );
-    rep->setSegmentInfo(info);
+    if ( segmentInfo )
+    {
+        SegmentInfo *info = new SegmentInfo( segmentInfo->getAttributes() );
+        this->setInitSegment( segmentInfo, info );
+        this->setSegments(segmentInfo, info );
+        rep->setSegmentInfo(info);
+    }
 }
+
 void    BasicCMParser::setInitSegment       (Node *root, SegmentInfo *info)
 {
     std::vector<Node *> initSeg = DOMHelper::getChildElementByTagName(root, "InitialisationSegmentURL");



More information about the vlc-commits mailing list