New media scanner: only use with valid path

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-09-21 13:22:10 +02:00
parent 4f38a46846
commit b01fdbab1b
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -1718,7 +1718,7 @@ public class FileDataStorageManager {
if (path != null) {
ContentValues values = new ContentValues();
ContentResolver contentResolver = MainApp.getAppContext().getContentResolver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && !TextUtils.isEmpty(path)) {
if (file != null) {
values.put(MediaStore.Images.Media.MIME_TYPE, file.getMimeType());
values.put(MediaStore.Images.Media.TITLE, file.getFileName());