Make onSnapshotFailed run on main thread. (#347)

This commit is contained in:
Kevin Li
2020-04-28 17:48:26 +08:00
committed by GitHub
parent 847774712b
commit c77a49c15c

View File

@@ -721,16 +721,20 @@ public class MapSnapshotter {
/**
* Called by JNI peer when snapshot has failed.
* Always called on the origin (main) thread.
*
* @param reason the exception string
*/
@Keep
protected void onSnapshotFailed(String reason) {
if (errorHandler != null) {
errorHandler.onError(reason);
reset();
}
protected void onSnapshotFailed(final String reason) {
new Handler().post(new Runnable() {
@Override
public void run() {
if (errorHandler != null) {
errorHandler.onError(reason);
reset();
}
}
});
}
/**