Fix an issue when the current address immediatly after an AdvancePC debug instruction doesn't point to an instruction

git-svn-id: https://smali.googlecode.com/svn/trunk@515 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
diff --git a/dexlib/src/main/java/org/jf/dexlib/CodeItem.java b/dexlib/src/main/java/org/jf/dexlib/CodeItem.java
index 2954f5f..68ebd38 100644
--- a/dexlib/src/main/java/org/jf/dexlib/CodeItem.java
+++ b/dexlib/src/main/java/org/jf/dexlib/CodeItem.java
@@ -639,6 +639,16 @@
             }
 
             int newOffset = newOffsetsByOriginalOffset.get(address*2, -1);
+
+            //The address might not point to an actual instruction in some cases, for example, if an AdvancePC
+            //instruction was inserted just before a "special" instruction, to fix up the offsets for a previous
+            //instruction replacement.
+            //In this case, it should be safe to skip, because there will be another AdvancePC/SpecialOpcode that will
+            //bump up the address to point to a valid instruction before anything (line/local/etc.) is emitted
+            if (newOffset == -1) {
+                return;
+            }
+
             assert newOffset != -1;
             newOffset = newOffset / 2;