Commit 391e5619 authored by Geoffrey Métais's avatar Geoffrey Métais

Fail ML init if context or folders aren't ready

parent 21b5c62b
......@@ -74,7 +74,13 @@ public class Medialibrary {
}
public boolean init(Context context) {
mIsInitiated = nativeInit(context.getCacheDir()+ VLC_MEDIA_DB_NAME, context.getExternalFilesDir(null).getAbsolutePath()+ THUMBS_FOLDER_NAME);
if (context == null)
return false;
File cacheDir = context.getCacheDir();
File extFilesDir = context.getExternalFilesDir(null);
if (extFilesDir == null || !cacheDir.exists() || !extFilesDir.exists())
return false;
mIsInitiated = nativeInit(cacheDir+ VLC_MEDIA_DB_NAME, extFilesDir.getAbsolutePath()+ THUMBS_FOLDER_NAME);
return mIsInitiated;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment