Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

Commit

Permalink
Defensive null check to avoid null pointer exception on HolderActivit…
Browse files Browse the repository at this point in the history
…y when the application has been destroyed on the background.

Closes #9
  • Loading branch information
Victor committed Aug 6, 2016
1 parent c82464f commit 8885440
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 51 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ allprojects {
And add next dependencies in the build.gradle of the module:
```gradle
dependencies {
compile "com.github.VictorAlbertos:RxActivityResult:0.3.4"
compile "io.reactivex:rxjava:1.1.5"
compile "com.github.VictorAlbertos:RxActivityResult:0.3.5"
compile "io.reactivex:rxjava:1.1.8"
}
```

Expand Down

This file was deleted.

10 changes: 5 additions & 5 deletions rx_activity_result/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ apply plugin: 'com.github.dcendents.android-maven'
group='com.github.VictorAlbertos'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
minSdkVersion 16
targetSdkVersion 23
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
Expand All @@ -22,8 +22,8 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'io.reactivex:rxjava:1.1.5'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'io.reactivex:rxjava:1.1.8'

testCompile 'junit:junit:4.12'
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public class HolderActivity extends Activity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

if (request == null) {
finish();
return;
}

onResult = request.onResult();

if (savedInstanceState != null) return;
Expand Down Expand Up @@ -76,7 +81,8 @@ private void startIntentSenderWithOptions(RequestIntentSender requestIntentSende

@Override protected void onDestroy() {
super.onDestroy();
onResult.response(resultCode, data);
if (onResult != null)
onResult.response(resultCode, data);
}

static void setRequest(Request aRequest) {
Expand Down

This file was deleted.

0 comments on commit 8885440

Please sign in to comment.