Better handle of 0 edge case in duplicate method skipping

Change-Id: Ic701096167e57d8e639a16e4dee8eea2cbb3e0a8
diff --git a/src/dex_file.cc b/src/dex_file.cc
index eb48ded..78f0fdc 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -824,7 +824,7 @@
 void ClassDataItemIterator::ReadClassDataField() {
   field_.field_idx_delta_ = DecodeUnsignedLeb128(&ptr_pos_);
   field_.access_flags_ = DecodeUnsignedLeb128(&ptr_pos_);
-  if (field_.field_idx_delta_ == 0) {
+  if (last_idx_ != 0 && field_.field_idx_delta_ == 0) {
     LOG(WARNING) << "Duplicate field " << PrettyField(GetMemberIndex(), dex_file_)
                  << " in " << dex_file_.GetLocation();
   }
@@ -834,7 +834,7 @@
   method_.method_idx_delta_ = DecodeUnsignedLeb128(&ptr_pos_);
   method_.access_flags_ = DecodeUnsignedLeb128(&ptr_pos_);
   method_.code_off_ = DecodeUnsignedLeb128(&ptr_pos_);
-  if (method_.method_idx_delta_ == 0) {
+  if (last_idx_ != 0 && method_.method_idx_delta_ == 0) {
     LOG(WARNING) << "Duplicate method " << PrettyMethod(GetMemberIndex(), dex_file_)
                  << " in " << dex_file_.GetLocation();
   }