[vlmc-devel] commit: Clip: Fixed crash when parent media isn't found ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sun Jun 20 23:50:34 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Jun 20 23:26:26 2010 +0200| [4079c0470a5b1fefdf91e2d466eb6e50013cb4fc] | committer: Hugo Beauzée-Luyssen 

Clip: Fixed crash when parent media isn't found

This was clearly not a good way of checking for the existance of an
element in a QHash...

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

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

diff --git a/src/Library/MediaContainer.cpp b/src/Library/MediaContainer.cpp
index 56f5e34..b90f1b9 100644
--- a/src/Library/MediaContainer.cpp
+++ b/src/Library/MediaContainer.cpp
@@ -203,13 +203,19 @@ MediaContainer::load( const QDomElement &clips, MediaContainer *parentMC )
         if ( clip.hasAttribute( "media" ) == true )
         {
             QString media = clip.attribute( "media" );
-            Media*  m = m_medias[media];
-            if ( m != NULL )
+            if ( m_medias.contains( media ) == true )
             {
+                Media*  m = m_medias[media];
                 c = new Clip( m, 0, -1, uuid );
                 m->setBaseClip( c );
                 addClip( c );
             }
+            else
+            {
+                qWarning() << "Can't find parent media:" << media;
+                clip = clip.nextSibling().toElement();
+                continue ;
+            }
         }
         else
         {



More information about the Vlmc-devel mailing list