Avoid NPEs when checking the current thread in SimpleExoPlayer

Before, Looper.myLooper().getThread() could throw an NPE if the current
thread didn't have any looper.

#minor-release

PiperOrigin-RevId: 371097485
This commit is contained in:
kimvde 2021-04-29 13:03:52 +01:00 committed by bachinger
parent cfec557ff0
commit ce8259e20a

View file

@ -2023,8 +2023,7 @@ public class SimpleExoPlayer extends BasePlayer
+ "Current thread: '%s'\n"
+ "Expected thread: '%s'\n"
+ "See https://exoplayer.dev/issues/player-accessed-on-wrong-thread",
Looper.myLooper().getThread().getName(),
getApplicationLooper().getThread().getName());
Thread.currentThread().getName(), getApplicationLooper().getThread().getName());
if (throwsWhenUsingWrongThread) {
throw new IllegalStateException(message);
}