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

yikei lu luyikei.qmltu at gmail.com
Thu Jul 21 13:04:59 CEST 2016


2016-07-21 20:01 GMT+09:00 Pawel Golinski <golpaw1 at gmail.com>:
> ---
>  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 )

m_mltRepo will never be nullptr.

>      {
> -        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)
>
> _______________________________________________
> Vlmc-devel mailing list
> Vlmc-devel at videolan.org
> https://mailman.videolan.org/listinfo/vlmc-devel


More information about the Vlmc-devel mailing list