mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Fixed crash when ScribbleView failed to save.
Previously, if an operation failed, we set the result to "null". However, this was a mistake. Setting the result at all assumes success. Instead, we need to set an exception so the ListenableFuture knows that the operation failed.
This commit is contained in:
parent
e65cd2636b
commit
542e962be9
@ -584,6 +584,9 @@
|
||||
<string name="RingtonePreference_add_ringtone_text">Add ringtone</string>
|
||||
<string name="RingtonePreference_unable_to_add_ringtone">Unable to add custom ringtone</string>
|
||||
|
||||
<!-- ScribbleActivity -->
|
||||
<string name="ScribbleActivity_save_failure">Failed to save image changes</string>
|
||||
|
||||
<!-- Search -->
|
||||
<string name="SearchFragment_begin_searching">Begin typing to search for conversations, messages, and contacts.</string>
|
||||
<string name="SearchFragment_no_results">No results found for \'%s\'</string>
|
||||
|
@ -14,6 +14,7 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
@ -242,6 +243,8 @@ public class ScribbleActivity extends PassphraseRequiredActionBarActivity implem
|
||||
@Override
|
||||
public void onFailure(ExecutionException e) {
|
||||
Log.w(TAG, e);
|
||||
Toast.makeText(ScribbleActivity.this, R.string.ScribbleActivity_save_failure, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class ScribbleView extends FrameLayout {
|
||||
final boolean isLowMemory = Util.isLowMemory(context);
|
||||
|
||||
if (imageUri == null) {
|
||||
future.set(null);
|
||||
future.setException(new IllegalStateException("No image URI."));
|
||||
return future;
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ public class ScribbleView extends FrameLayout {
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
future.set(null);
|
||||
future.setException(new Throwable("Failed to load image."));
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user