[vlmc-devel] commit: MediaContainer: Avoid potential crash. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Tue Sep 21 15:04:45 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Sep 17 16:51:24 2010 +0200| [acc18306e6906fac69c30e9c466a0880b14b3d89] | committer: Hugo Beauzée-Luyssen 

MediaContainer: Avoid potential crash.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=acc18306e6906fac69c30e9c466a0880b14b3d89
---

 src/Library/MediaContainer.cpp |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/Library/MediaContainer.cpp b/src/Library/MediaContainer.cpp
index 6dc55c5..9390489 100644
--- a/src/Library/MediaContainer.cpp
+++ b/src/Library/MediaContainer.cpp
@@ -200,7 +200,7 @@ MediaContainer::load( const QDomElement &clips, MediaContainer *parentMC )
         QString     uuid = clip.attribute( "uuid" );
         QString     metatags = clip.attribute( "metatags" );
         QString     notes = clip.attribute( "notes" );
-        Clip        *c;
+        Clip        *c = NULL;
 
         if ( clip.hasAttribute( "media" ) == true )
         {
@@ -236,12 +236,15 @@ MediaContainer::load( const QDomElement &clips, MediaContainer *parentMC )
                 addClip( c );
             }
         }
-        if ( metatags.isEmpty() == false )
-            c->setMetaTags( metatags.split( ',' ) );
-        c->setNotes( notes );
-        QDomElement subClips = clip.firstChildElement( "subClips" );
-        if ( subClips.isNull() == false )
-            c->getChilds()->load( subClips, this );
+        if ( c != NULL )
+        {
+            if ( metatags.isEmpty() == false )
+                c->setMetaTags( metatags.split( ',' ) );
+            c->setNotes( notes );
+            QDomElement subClips = clip.firstChildElement( "subClips" );
+            if ( subClips.isNull() == false )
+                c->getChilds()->load( subClips, this );
+        }
         clip = clip.nextSiblingElement();
     }
 }



More information about the Vlmc-devel mailing list