From 0656cbc18d30ba75faa3863872ce316ff237d6f0 Mon Sep 17 00:00:00 2001 From: miguelbcr Date: Wed, 25 Jan 2017 10:52:46 +0100 Subject: [PATCH] Handle FileNotFoundException --- .../miguelbcr/ui/rx_paparazzo/interactors/PickImage.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rx_paparazzo/src/main/java/com/miguelbcr/ui/rx_paparazzo/interactors/PickImage.java b/rx_paparazzo/src/main/java/com/miguelbcr/ui/rx_paparazzo/interactors/PickImage.java index 9e4a11d..6ea7b4f 100644 --- a/rx_paparazzo/src/main/java/com/miguelbcr/ui/rx_paparazzo/interactors/PickImage.java +++ b/rx_paparazzo/src/main/java/com/miguelbcr/ui/rx_paparazzo/interactors/PickImage.java @@ -22,6 +22,8 @@ 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; @@ -66,6 +68,11 @@ public Observable response(int responseCode, @Nullable final Intent inte intent.setData(Uri.fromFile(new File(filePath))); return filePath; } + }) + .onErrorResumeNext(new Func1>() { + @Override public Observable call(Throwable throwable) { + return Observable.just(""); + } }); } else { return Observable.just("");