Check for null

This commit is contained in:
Martin Fietz 2017-10-19 21:04:45 +02:00
parent 557d97b450
commit 3a150ac428
1 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,9 @@ public class MediaButtonReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.d(TAG, "Received intent"); Log.d(TAG, "Received intent");
if (intent == null || intent.getExtras() == null) {
return;
}
KeyEvent event = (KeyEvent) intent.getExtras().get(Intent.EXTRA_KEY_EVENT); KeyEvent event = (KeyEvent) intent.getExtras().get(Intent.EXTRA_KEY_EVENT);
if (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount()==0) { if (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount()==0) {
ClientConfig.initialize(context); ClientConfig.initialize(context);