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

Commit 2e12d552 authored by Julia Tuttle's avatar Julia Tuttle
Browse files

MessagingImageMessage: Don't crash if measured after recycle

We're hoping to gut the recycling code in the messaging notification
code entirely (it's a lot of complexity for apparently little or no
performance gain), but in the meantime, mitigate a System UI crash.

Bug: 231025249
Test: none, I found no unit tests to start with
Change-Id: I3bcc14d102a87ed96ce37241d25eccf44ba2acb0
parent 2274df1e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -226,6 +226,13 @@ public class MessagingImageMessage extends ImageView implements MessagingMessage
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        if (mDrawable == null) {
            Log.e(TAG, "onMeasure() after recycle()!");
            setMeasuredDimension(0, 0);
            return;
        }

        if (mIsIsolated) {
            // When isolated we have a fixed size, let's use that sizing.
            setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),