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

Commit 15afdebe authored by Kweku Adams's avatar Kweku Adams
Browse files

Avoiding potential NPE when dumping to proto.

Inspired by http://aosp/736453.

Bug: 113087610
Test: Android builds
Change-Id: I9f0dae9cd5a839947c7ed150980eb30b928beef7
parent 54cf4aea
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1151,7 +1151,9 @@ public class AlarmManager {
        public void writeToProto(ProtoOutputStream proto, long fieldId) {
            final long token = proto.start(fieldId);
            proto.write(AlarmClockInfoProto.TRIGGER_TIME_MS, mTriggerTime);
            if (mShowIntent != null) {
                mShowIntent.writeToProto(proto, AlarmClockInfoProto.SHOW_INTENT);
            }
            proto.end(token);
        }
    }
+6 −2
Original line number Diff line number Diff line
@@ -1096,7 +1096,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
        protoOutputStream.write(FONT_SCALE, fontScale);
        protoOutputStream.write(MCC, mcc);
        protoOutputStream.write(MNC, mnc);
        if (mLocaleList != null) {
            mLocaleList.writeToProto(protoOutputStream, LOCALES);
        }
        protoOutputStream.write(SCREEN_LAYOUT, screenLayout);
        protoOutputStream.write(COLOR_MODE, colorMode);
        protoOutputStream.write(TOUCHSCREEN, touchscreen);
@@ -1111,7 +1113,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
        protoOutputStream.write(SCREEN_HEIGHT_DP, screenHeightDp);
        protoOutputStream.write(SMALLEST_SCREEN_WIDTH_DP, smallestScreenWidthDp);
        protoOutputStream.write(DENSITY_DPI, densityDpi);
        if (windowConfiguration != null) {
            windowConfiguration.writeToProto(protoOutputStream, WINDOW_CONFIGURATION);
        }
        protoOutputStream.end(token);
    }

+3 −1
Original line number Diff line number Diff line
@@ -386,7 +386,9 @@ public final class Looper {
        final long looperToken = proto.start(fieldId);
        proto.write(LooperProto.THREAD_NAME, mThread.getName());
        proto.write(LooperProto.THREAD_ID, mThread.getId());
        if (mQueue != null) {
            mQueue.writeToProto(proto, LooperProto.QUEUE);
        }
        proto.end(looperToken);
    }