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

Commit ae0596cc authored by Dmitri Plotnikov's avatar Dmitri Plotnikov Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE caused by a null battery history tag"

parents 3176e857 b6d0af35
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -7354,9 +7354,11 @@ public abstract class BatteryStats implements Parcelable {
                        pw.print(getHistoryTagPoolUid(i));
                        pw.print(getHistoryTagPoolUid(i));
                        pw.print(",\"");
                        pw.print(",\"");
                        String str = getHistoryTagPoolString(i);
                        String str = getHistoryTagPoolString(i);
                        if (str != null) {
                            str = str.replace("\\", "\\\\");
                            str = str.replace("\\", "\\\\");
                            str = str.replace("\"", "\\\"");
                            str = str.replace("\"", "\\\"");
                            pw.print(str);
                            pw.print(str);
                        }
                        pw.print("\"");
                        pw.print("\"");
                        pw.println();
                        pw.println();
                    }
                    }
+4 −0
Original line number Original line Diff line number Diff line
@@ -3522,6 +3522,10 @@ public class BatteryStatsImpl extends BatteryStats {
     * <code>(index | TAG_FIRST_OCCURRENCE_FLAG)</code>
     * <code>(index | TAG_FIRST_OCCURRENCE_FLAG)</code>
     */
     */
    private int writeHistoryTag(HistoryTag tag) {
    private int writeHistoryTag(HistoryTag tag) {
        if (tag.string == null) {
            Slog.wtfStack(TAG, "writeHistoryTag called with null name");
        }
        Integer idxObj = mHistoryTagPool.get(tag);
        Integer idxObj = mHistoryTagPool.get(tag);
        int idx;
        int idx;
        if (idxObj != null) {
        if (idxObj != null) {