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

Commit 09c2cc73 authored by Bruno Martins's avatar Bruno Martins Committed by Michael Bestas
Browse files

Recorder: Avoid NPE when screen recording is about to finish

 * The following crash can be reproduced in some devices by
   starting a screen recording and then stopping it from the
   sticky notification:

    E AndroidRuntime: FATAL EXCEPTION: Encoder
    E AndroidRuntime: Process: org.lineageos.recorder, PID: 3187
    E AndroidRuntime: java.lang.NullPointerException: println needs a message
    E AndroidRuntime:        at android.util.Log.println_native(Native Method)
    E AndroidRuntime:        at android.util.Log.e(Log.java:240)
    E AndroidRuntime:        at org.lineageos.recorder.screen.EncoderDevice$EncoderRunnable.run(EncoderDevice.java:320)
    E AndroidRuntime:        at java.lang.Thread.run(Thread.java:764)
    I ActivityManager: Showing crash dialog for package org.lineageos.recorder u0

 * This also matches other try...catch blocks used in other parts
   of the code.

Change-Id: I8cd1d2f0be250603b791dd7be7db85f62b3ac26e
parent 518aa461
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -317,10 +317,11 @@ abstract class EncoderDevice {
            try {
                encode();
            } catch (Exception e) {
                Log.e(LOGTAG, e.getMessage());
            }
                Log.e(LOGTAG, "EncoderDevice error", e);
            } finally {
                cleanup();
                Log.i(LOGTAG, "=======ENCODING COMPLETE=======");
            }
        }
    }
}