Fix when 'name' or 'type' of StartLocal (DexDebugEvent) are null. Both 'name' and 'type' for DBG_START_LOCAL or DBG_START_LOCAL_EXTENDED can be NO_INDEX in which case the corresponding fields will be null. Change-Id: I77a52557f35f968d2d3090bf09ab014c9b633cb6
diff --git a/src/main/java/com/android/tools/r8/graph/DexDebugEvent.java b/src/main/java/com/android/tools/r8/graph/DexDebugEvent.java index dba4842..35108bd 100644 --- a/src/main/java/com/android/tools/r8/graph/DexDebugEvent.java +++ b/src/main/java/com/android/tools/r8/graph/DexDebugEvent.java
@@ -213,8 +213,12 @@ @Override public void collectIndexedItems(IndexedItemCollection collection) { - name.collectIndexedItems(collection); - type.collectIndexedItems(collection); + if (name != null) { + name.collectIndexedItems(collection); + } + if (type != null) { + type.collectIndexedItems(collection); + } if (signature != null) { signature.collectIndexedItems(collection); } @@ -234,8 +238,8 @@ public int hashCode() { return Constants.DBG_START_LOCAL + registerNum * 7 - + name.hashCode() * 13 - + type.hashCode() * 17 + + Objects.hashCode(name) * 13 + + Objects.hashCode(type) * 17 + Objects.hashCode(signature) * 19; } @@ -248,10 +252,10 @@ if (registerNum != o.registerNum) { return false; } - if (!name.equals(o.name)) { + if (!Objects.equals(name, o.name)) { return false; } - if (!type.equals(o.type)) { + if (!Objects.equals(type, o.type)) { return false; } return Objects.equals(signature, o.signature);