mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
fix NPE: ringtone can be null on older OS
This commit is contained in:
parent
73fdb4a578
commit
d6dd851349
1 changed files with 5 additions and 1 deletions
|
@ -35,6 +35,7 @@ import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
import android.media.Ringtone;
|
||||||
import android.media.RingtoneManager;
|
import android.media.RingtoneManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.provider.ContactsContract.PhoneLookup;
|
import android.provider.ContactsContract.PhoneLookup;
|
||||||
|
@ -243,7 +244,10 @@ public class Utils {
|
||||||
if ( CommonPrefs.getSoundNotify( context ) ) {
|
if ( CommonPrefs.getSoundNotify( context ) ) {
|
||||||
Uri uri = RingtoneManager
|
Uri uri = RingtoneManager
|
||||||
.getDefaultUri( RingtoneManager.TYPE_NOTIFICATION );
|
.getDefaultUri( RingtoneManager.TYPE_NOTIFICATION );
|
||||||
RingtoneManager.getRingtone( context, uri ).play();
|
Ringtone ringtone = RingtoneManager.getRingtone( context, uri );
|
||||||
|
if ( null != ringtone ) {
|
||||||
|
ringtone.play();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue