Fix InvalidProtoWireException

The NPE here would catch in the outer try-catch causing the end object
token to not be written by ProtoOutputStream

Bug: 187098431
Test: atest IncidentdTest#testIncidentReportDumpLocal
Change-Id: I65fb92c077e246aaf2ae902b545fea38dd667e25
This commit is contained in:
Jeffrey Huang
2021-05-04 16:32:39 -07:00
parent aa4fa8089e
commit dd4f6314cc

View File

@@ -659,7 +659,8 @@ public class ZenModeHelper {
mConfig.manualRule.dumpDebug(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS);
}
for (ZenRule rule : mConfig.automaticRules.values()) {
if (rule.enabled && rule.condition.state == Condition.STATE_TRUE
if (rule.enabled && rule.condition != null
&& rule.condition.state == Condition.STATE_TRUE
&& !rule.snoozing) {
rule.dumpDebug(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS);
}