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

Commit 46a61bb7 authored by Romain Guy's avatar Romain Guy
Browse files

Prevent crash in KeyboardView when the view is 0x0.

parent 5d36c46d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -620,7 +620,10 @@ public class KeyboardView extends View implements View.OnClickListener {
        if (mBuffer == null || mKeyboardChanged) {
            if (mBuffer == null || mKeyboardChanged &&
                    (mBuffer.getWidth() != getWidth() || mBuffer.getHeight() != getHeight())) {
                mBuffer = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
                // Make sure our bitmap is at least 1x1
                final int width = Math.max(1, getWidth());
                final int height = Math.max(1, getHeight());
                mBuffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
                mCanvas = new Canvas(mBuffer);
            }
            invalidateAllKeys();