mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Be more robust against load callback failures
Issue: #2795 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=174836960
This commit is contained in:
parent
f014b67d3e
commit
7f135f2cda
@ -380,7 +380,13 @@ public final class Loader implements LoaderErrorThrower {
|
||||
callback.onLoadCanceled(loadable, nowMs, durationMs, false);
|
||||
break;
|
||||
case MSG_END_OF_SOURCE:
|
||||
callback.onLoadCompleted(loadable, nowMs, durationMs);
|
||||
try {
|
||||
callback.onLoadCompleted(loadable, nowMs, durationMs);
|
||||
} catch (RuntimeException e) {
|
||||
// This should never happen, but handle it anyway.
|
||||
Log.e(TAG, "Unexpected exception handling load completed", e);
|
||||
fatalError = new UnexpectedLoaderException(e);
|
||||
}
|
||||
break;
|
||||
case MSG_IO_EXCEPTION:
|
||||
currentError = (IOException) msg.obj;
|
||||
@ -392,6 +398,9 @@ public final class Loader implements LoaderErrorThrower {
|
||||
start(getRetryDelayMillis());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Never happens.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user