Avoid NPEs

This commit is contained in:
Martin Fietz 2018-01-10 22:44:52 +01:00
parent ce2aeb5e90
commit c524791c3c
1 changed files with 5 additions and 1 deletions

View File

@ -28,6 +28,9 @@ public class AudioplayerActivity extends MediaplayerInfoActivity {
super.onResume();
if (TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) {
Intent intent = getIntent();
if (intent.getData() == null) {
return;
}
Log.d(TAG, "Received VIEW intent: " + intent.getData().getPath());
ExternalMedia media = new ExternalMedia(intent.getData().getPath(),
MediaType.AUDIO);
@ -41,7 +44,8 @@ public class AudioplayerActivity extends MediaplayerInfoActivity {
startService(launchIntent);
} else if (PlaybackService.isCasting()) {
Intent intent = PlaybackService.getPlayerActivityIntent(this);
if (!intent.getComponent().getClassName().equals(AudioplayerActivity.class.getName())) {
if (intent.getComponent() != null &&
!intent.getComponent().getClassName().equals(AudioplayerActivity.class.getName())) {
saveCurrentFragment();
finish();
startActivity(intent);