]> git.sesse.net Git - mlt/commitdiff
Add null pointer checks around profile in consumer xml.
authorDan Dennedy <dan@dennedy.org>
Thu, 14 Oct 2010 03:00:23 +0000 (20:00 -0700)
committerDan Dennedy <dan@dennedy.org>
Thu, 14 Oct 2010 03:00:23 +0000 (20:00 -0700)
src/modules/xml/consumer_xml.c

index f093ffe014dc9faebe93b8c092e9d5efb8bf0ca2..41c8b428a1eff92064dd0f8c86283430323818a7 100644 (file)
@@ -656,27 +656,31 @@ xmlDocPtr xml_make_doc( mlt_consumer consumer, mlt_service service )
        mlt_properties_set_int( properties, "global_feed", 1 );
 
        // Add a profile child element
-       xmlNewProp( profile_node, _x("description"), _x(profile->description) );
-       sprintf( tmpstr, "%d", profile->width );
-       xmlNewProp( profile_node, _x("width"), _x(tmpstr) );
-       sprintf( tmpstr, "%d", profile->height );
-       xmlNewProp( profile_node, _x("height"), _x(tmpstr) );
-       sprintf( tmpstr, "%d", profile->progressive );
-       xmlNewProp( profile_node, _x("progressive"), _x(tmpstr) );
-       sprintf( tmpstr, "%d", profile->sample_aspect_num );
-       xmlNewProp( profile_node, _x("sample_aspect_num"), _x(tmpstr) );
-       sprintf( tmpstr, "%d", profile->sample_aspect_den );
-       xmlNewProp( profile_node, _x("sample_aspect_den"), _x(tmpstr) );
-       sprintf( tmpstr, "%d", profile->display_aspect_num );
-       xmlNewProp( profile_node, _x("display_aspect_num"), _x(tmpstr) );
-       sprintf( tmpstr, "%d", profile->display_aspect_den );
-       xmlNewProp( profile_node, _x("display_aspect_den"), _x(tmpstr) );
-       sprintf( tmpstr, "%d", profile->frame_rate_num );
-       xmlNewProp( profile_node, _x("frame_rate_num"), _x(tmpstr) );
-       sprintf( tmpstr, "%d", profile->frame_rate_den );
-       xmlNewProp( profile_node, _x("frame_rate_den"), _x(tmpstr) );
-       sprintf( tmpstr, "%d", profile->colorspace );
-       xmlNewProp( profile_node, _x("colorspace"), _x(tmpstr) );
+       if ( profile )
+       {
+               if ( profile->description )
+                       xmlNewProp( profile_node, _x("description"), _x(profile->description) );
+               sprintf( tmpstr, "%d", profile->width );
+               xmlNewProp( profile_node, _x("width"), _x(tmpstr) );
+               sprintf( tmpstr, "%d", profile->height );
+               xmlNewProp( profile_node, _x("height"), _x(tmpstr) );
+               sprintf( tmpstr, "%d", profile->progressive );
+               xmlNewProp( profile_node, _x("progressive"), _x(tmpstr) );
+               sprintf( tmpstr, "%d", profile->sample_aspect_num );
+               xmlNewProp( profile_node, _x("sample_aspect_num"), _x(tmpstr) );
+               sprintf( tmpstr, "%d", profile->sample_aspect_den );
+               xmlNewProp( profile_node, _x("sample_aspect_den"), _x(tmpstr) );
+               sprintf( tmpstr, "%d", profile->display_aspect_num );
+               xmlNewProp( profile_node, _x("display_aspect_num"), _x(tmpstr) );
+               sprintf( tmpstr, "%d", profile->display_aspect_den );
+               xmlNewProp( profile_node, _x("display_aspect_den"), _x(tmpstr) );
+               sprintf( tmpstr, "%d", profile->frame_rate_num );
+               xmlNewProp( profile_node, _x("frame_rate_num"), _x(tmpstr) );
+               sprintf( tmpstr, "%d", profile->frame_rate_den );
+               xmlNewProp( profile_node, _x("frame_rate_den"), _x(tmpstr) );
+               sprintf( tmpstr, "%d", profile->colorspace );
+               xmlNewProp( profile_node, _x("colorspace"), _x(tmpstr) );
+       }
 
        // Construct the context maps
        context->id_map = mlt_properties_new();