From d63b946c7da1816b507d45c0c76398ac386622be Mon Sep 17 00:00:00 2001 From: Evgeny Shishkin Date: Tue, 13 Nov 2018 16:18:11 +0300 Subject: [PATCH] Prepare version 1.0.3 --- CHANGELOG.md | 7 +++++++ README.md | 2 +- build.gradle | 4 ++-- .../java/com/jetradar/permissions/PermissionsDelegate.kt | 7 ++++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7179218..f87fd12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ Change Log ========== +## Version 1.0.3 + +_2018-11-13_ + + * Fixed crash if could not find result subject for permission. + + ## Version 1.0.2 _2018-10-25_ diff --git a/README.md b/README.md index 3ac09e0..1d17b90 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Add the dependency ```groovy dependencies { - compile 'com.github.jetradarmobile:mrbutler:1.0.2' + compile 'com.github.jetradarmobile:mrbutler:1.0.3' } ``` diff --git a/build.gradle b/build.gradle index 3046529..91f0d4b 100644 --- a/build.gradle +++ b/build.gradle @@ -3,8 +3,8 @@ buildscript { 'compileSdk': 28, 'minSdk' : 14, - 'kotlin' : '1.2.71', - 'appcompat' : '1.0.0', + 'kotlin' : '1.3.0', + 'appcompat' : '1.0.2', 'fragment' : '1.0.0', 'rxjava' : '2.2.3', 'rxrelay' : '2.1.0', diff --git a/mrbutler/src/main/java/com/jetradar/permissions/PermissionsDelegate.kt b/mrbutler/src/main/java/com/jetradar/permissions/PermissionsDelegate.kt index df1cb2e..adf26a2 100644 --- a/mrbutler/src/main/java/com/jetradar/permissions/PermissionsDelegate.kt +++ b/mrbutler/src/main/java/com/jetradar/permissions/PermissionsDelegate.kt @@ -18,6 +18,7 @@ package com.jetradar.permissions import android.annotation.SuppressLint import android.content.pm.PackageManager +import android.util.Log import com.jakewharton.rxrelay2.PublishRelay import io.reactivex.Observable import io.reactivex.Single @@ -77,7 +78,11 @@ abstract class PermissionsDelegate : PermissionsHandler { fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { if (requestCode != PERMISSIONS_REQUEST_CODE) return permissions.forEachIndexed { index, permission -> - val resultSubject = checkNotNull(requestPermissionResultSubjects.remove(permission)) { "Could not find corresponding result subject" } + val resultSubject = requestPermissionResultSubjects.remove(permission) + if (resultSubject == null) { + Log.e("MrButler", "Could not find result subject for $permission") + return@forEachIndexed + } val component = checkNotNull(componentRef?.get()) { "Component not attached" } val isPermissionGranted = grantResults[index] == PackageManager.PERMISSION_GRANTED resultSubject.onSuccess(