Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62b9aec7 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Don't check return value of new for being == null

new either succeeds or throws an exception

Change-Id: I1615e10c4f6730495c49e56b64714a00141ea8ff
parent e2d58e95
Loading
Loading
Loading
Loading
+24 −30
Original line number Diff line number Diff line
@@ -1015,10 +1015,6 @@ public class AudioService extends IAudioService.Stub {
                return true;
            }
            mSoundPool = new SoundPool(NUM_SOUNDPOOL_CHANNELS, AudioSystem.STREAM_SYSTEM, 0);
            if (mSoundPool == null) {
                Log.w(TAG, "loadSoundEffects() could not allocate sound pool");
                return false;
            }

            try {
                mSoundPoolCallBack = null;
@@ -2093,7 +2089,6 @@ public class AudioService extends IAudioService.Stub {
                    mSoundPool.play(SOUND_EFFECT_FILES_MAP[effectType][1], volFloat, volFloat, 0, 0, 1.0f);
                } else {
                    MediaPlayer mediaPlayer = new MediaPlayer();
                    if (mediaPlayer != null) {
                    try {
                        String filePath = Environment.getRootDirectory() + SOUND_EFFECTS_PATH + SOUND_EFFECT_FILES[SOUND_EFFECT_FILES_MAP[effectType][0]];
                        mediaPlayer.setDataSource(filePath);
@@ -2122,7 +2117,6 @@ public class AudioService extends IAudioService.Stub {
                }
            }
        }
        }

        private void onHandlePersistMediaButtonReceiver(ComponentName receiver) {
            Settings.System.putString(mContentResolver, Settings.System.MEDIA_BUTTON_RECEIVER,
+4 −6
Original line number Diff line number Diff line
@@ -161,13 +161,11 @@ public class SoundPool
        int id = 0;
        try {
            File f = new File(path);
            if (f != null) {
            ParcelFileDescriptor fd = ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
            if (fd != null) {
                id = _load(fd.getFileDescriptor(), 0, f.length(), priority);
                fd.close();
            }
            }
        } catch (java.io.IOException e) {
            Log.e(TAG, "error loading " + path);
        }
+1 −3
Original line number Diff line number Diff line
@@ -472,9 +472,7 @@ public class ThumbnailUtils {
        byte [] thumbData = null;
        try {
            exif = new ExifInterface(filePath);
            if (exif != null) {
            thumbData = exif.getThumbnail();
            }
        } catch (IOException ex) {
            Log.w(TAG, ex);
        }