Merge pull request #602 from ultrasonic/fix_npe

Fix NPE
This commit is contained in:
tzugen 2021-10-13 18:45:41 +02:00 committed by GitHub
commit ec4f57b5b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -7,8 +7,8 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import timber.log.Timber;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.PermissionChecker;
@ -24,6 +24,8 @@ import org.moire.ultrasonic.R;
import java.util.List;
import timber.log.Timber;
import static androidx.core.content.PermissionChecker.PERMISSION_DENIED;
@ -59,7 +61,7 @@ public class PermissionUtil {
*
* @param callback callback function to execute after the permission request is finished
*/
public void handlePermissionFailed(final PermissionRequestFinishedCallback callback) {
public void handlePermissionFailed(@Nullable final PermissionRequestFinishedCallback callback) {
String currentCachePath = Settings.getPreferences().getString(Constants.PREFERENCES_KEY_CACHE_LOCATION, FileUtil.getDefaultMusicDirectory().getPath());
String defaultCachePath = FileUtil.getDefaultMusicDirectory().getPath();
@ -84,9 +86,11 @@ public class PermissionUtil {
}
});
}
if (callback != null) {
callback.onPermissionRequestFinished(false);
}
}
}
/**
* This function requests permission to access the filesystem.