Skip to content

Commit

Permalink
Merge pull request #60 from IlyaGulya/bugfix-nullpointer-getpath
Browse files Browse the repository at this point in the history
Fix NullPointerException in PickImage (Close #59)
  • Loading branch information
miguelbcr authored Feb 2, 2017
2 parents eff1732 + 60b36a4 commit 7a2c7fa
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.Nullable;

import java.io.File;

import rx.Observable;
import rx.exceptions.Exceptions;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
import rx_activity_result.OnPreResult;
Expand Down Expand Up @@ -59,7 +59,8 @@ private OnPreResult getOnPreResultProcessing() {
return new OnPreResult() {
@Override
public Observable<String> response(int responseCode, @Nullable final Intent intent) {
if (responseCode == Activity.RESULT_OK) {
final boolean dataExists = intent != null && intent.getData() != null;
if (responseCode == Activity.RESULT_OK && dataExists) {
return getPath.with(intent.getData())
.react()
.subscribeOn(Schedulers.io())
Expand Down

0 comments on commit 7a2c7fa

Please sign in to comment.