[vlmc-devel] [PATCH] MLTBackend: Error checking on m_mltRepo init

Pawel Golinski golpaw1 at gmail.com
Thu Jul 21 13:01:51 CEST 2016


---
 src/Backend/MLT/MLTBackend.cpp | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/Backend/MLT/MLTBackend.cpp b/src/Backend/MLT/MLTBackend.cpp
index 3d39930..44b9ba9 100644
--- a/src/Backend/MLT/MLTBackend.cpp
+++ b/src/Backend/MLT/MLTBackend.cpp
@@ -54,17 +54,24 @@ MLTBackend::MLTBackend()
     m_mltRepo = Mlt::Factory::init();
     m_profile.setFrameRate( 2997, 100 );
 
-    for ( int i = 0; i < m_mltRepo->filters()->count(); ++i )
+    if ( m_mltRepo )
     {
-        auto pro = std::unique_ptr<Mlt::Properties>( m_mltRepo->metadata( filter_type, m_mltRepo->filters()->get_name( i ) ) );
-        auto filterInfo = new MLTFilterInfo;
-        filterInfo->setProperties( pro.get() );
-        if ( filterInfo->identifier().empty() == true )
+        for ( int i = 0; i < m_mltRepo->filters()->count(); ++i )
         {
-            delete filterInfo;
-            continue;
+            auto pro = std::unique_ptr<Mlt::Properties>( m_mltRepo->metadata( filter_type, m_mltRepo->filters()->get_name( i ) ) );
+            auto filterInfo = new MLTFilterInfo;
+            filterInfo->setProperties( pro.get() );
+            if ( filterInfo->identifier().empty() == true )
+            {
+                delete filterInfo;
+                continue;
+            }
+            m_availableFilters[ filterInfo->identifier() ] = filterInfo;
         }
-        m_availableFilters[ filterInfo->identifier() ] = filterInfo;
+    }
+    else
+    {
+        throw InvalidServiceException();
     }
 }
 
-- 
2.7.4 (Apple Git-66)



More information about the Vlmc-devel mailing list