mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Fix track when no maps folder is selected
This commit is contained in:
@@ -86,19 +86,19 @@ public final class MapsManager {
|
|||||||
AndroidGraphicFactory.createInstance(GBApplication.app());
|
AndroidGraphicFactory.createInstance(GBApplication.app());
|
||||||
final GBPrefs prefs = GBApplication.getPrefs();
|
final GBPrefs prefs = GBApplication.getPrefs();
|
||||||
|
|
||||||
|
final DocumentFile[] documentFiles;
|
||||||
final String folderUri = prefs.getString(PREF_MAPS_FOLDER, "");
|
final String folderUri = prefs.getString(PREF_MAPS_FOLDER, "");
|
||||||
if (folderUri.isEmpty()) {
|
if (!folderUri.isEmpty()) {
|
||||||
return;
|
final DocumentFile folder = DocumentFile.fromTreeUri(mContext, Uri.parse(folderUri));
|
||||||
|
documentFiles = folder != null ? folder.listFiles() : new DocumentFile[0];
|
||||||
|
} else {
|
||||||
|
documentFiles = new DocumentFile[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
final DocumentFile folder = DocumentFile.fromTreeUri(mContext, Uri.parse(folderUri));
|
LOG.debug("Got {} map files", documentFiles.length);
|
||||||
|
|
||||||
final MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.RETURN_ALL);
|
final MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.RETURN_ALL);
|
||||||
|
|
||||||
final DocumentFile[] documentFiles = folder != null ? folder.listFiles() : new DocumentFile[0];
|
|
||||||
|
|
||||||
LOG.debug("Got {} map files", documentFiles.length);
|
|
||||||
|
|
||||||
for (final DocumentFile documentFile : documentFiles) {
|
for (final DocumentFile documentFile : documentFiles) {
|
||||||
if (!documentFile.canRead()) {
|
if (!documentFile.canRead()) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user