herususanto10121980 / chrometophone

Automatically exported from code.google.com/p/chrometophone
0 stars 0 forks source link

Null pointer exception when missing default ring-tone #207

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Fresh install of Android 2.2 API 8 w/ gtools on Eclipse (Ubuntu Linux).

On receive of link from Chrome extension > unhandled null pointer exception 
below ( rt not checked for null before call to setStreamType).  Also, can I 
please be enabled to commit to this project?

--------------------------------------------------------------
   private void playNotificationSound(Context context) {
       Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
       if (uri != null) {
           Ringtone rt = RingtoneManager.getRingtone(context, uri);
           rt.setStreamType(AudioManager.STREAM_NOTIFICATION);
           if (rt != null) rt.play();
       }
   } 

Original issue reported on code.google.com by ryan.avi...@gmail.com on 12 Sep 2010 at 10:56

GoogleCodeExporter commented 8 years ago
Note: this was within the ADB emulator, not from an install of the application 
on a phone.  

Original comment by ryan.avi...@gmail.com on 12 Sep 2010 at 11:32

GoogleCodeExporter commented 8 years ago
oops, i guess rt.setStreamType needs to go inside that if statement.

Original comment by loudti...@gmail.com on 13 Sep 2010 at 3:02

GoogleCodeExporter commented 8 years ago
Thanks, fixed in code. Will be in the next release.

Original comment by burke.da...@gmail.com on 28 Sep 2010 at 8:56