mlt_factory.c: guard against accessing mlt_environment before it is ready
[melted] / src / framework / mlt_factory.c
index cd19b15..4a14dec 100644 (file)
@@ -139,7 +139,10 @@ const char *mlt_factory_prefix( )
 
 char *mlt_environment( const char *name )
 {
-       return mlt_properties_get( global_properties, name );
+       if ( global_properties )
+               return mlt_properties_get( global_properties, name );
+       else
+               return NULL;
 }
 
 /** Set a value in the environment.
@@ -147,7 +150,10 @@ char *mlt_environment( const char *name )
 
 int mlt_environment_set( const char *name, const char *value )
 {
-       return mlt_properties_set( global_properties, name, value );
+       if ( global_properties )
+               return mlt_properties_set( global_properties, name, value );
+       else
+               return -1;
 }
 
 static void set_common_properties( mlt_properties properties, mlt_profile profile, const char *type, const char *service )