Fix for complex jsr nesting causing NullPointerException.

Happens when one jsr calls another that ultimates throws an exception.
The subroutine inliner assumes the return block of the first jsr is
reachable when it's not, causing access to a null field.  Fixed by
checking the field for null before accessing it.

Change-Id: Id1fb376c9f14ffebc77cdbd253a713eb6d949c1f
diff --git a/dx/src/com/android/dx/cf/code/BytecodeArray.java b/dx/src/com/android/dx/cf/code/BytecodeArray.java
index 6ede25c..f4ea007 100644
--- a/dx/src/com/android/dx/cf/code/BytecodeArray.java
+++ b/dx/src/com/android/dx/cf/code/BytecodeArray.java
@@ -1357,23 +1357,27 @@
         }
 
         /** {@inheritDoc} */
+        @Override
         public void visitInvalid(int opcode, int offset, int length) {
             clear();
         }
 
         /** {@inheritDoc} */
+        @Override
         public void visitNoArgs(int opcode, int offset, int length,
                 Type type) {
             clear();
         }
 
         /** {@inheritDoc} */
+        @Override
         public void visitLocal(int opcode, int offset, int length,
                 int idx, Type type, int value) {
             clear();
         }
 
         /** {@inheritDoc} */
+        @Override
         public void visitConstant(int opcode, int offset, int length,
                 Constant cst, int value) {
             this.cst = cst;
@@ -1382,29 +1386,34 @@
         }
 
         /** {@inheritDoc} */
+        @Override
         public void visitBranch(int opcode, int offset, int length,
                 int target) {
             clear();
         }
 
         /** {@inheritDoc} */
+        @Override
         public void visitSwitch(int opcode, int offset, int length,
                 SwitchList cases, int padding) {
             clear();
         }
 
         /** {@inheritDoc} */
+        @Override
         public void visitNewarray(int offset, int length, CstType type,
                 ArrayList<Constant> initVals) {
             clear();
         }
 
         /** {@inheritDoc} */
+        @Override
         public void setPreviousOffset(int offset) {
             // Intentionally left empty
         }
 
         /** {@inheritDoc} */
+        @Override
         public int getPreviousOffset() {
             // Intentionally left empty
             return -1;
diff --git a/dx/src/com/android/dx/cf/code/Ropper.java b/dx/src/com/android/dx/cf/code/Ropper.java
index 8217166..715cfd8 100644
--- a/dx/src/com/android/dx/cf/code/Ropper.java
+++ b/dx/src/com/android/dx/cf/code/Ropper.java
@@ -1427,7 +1427,7 @@
                     IntList.makeImmutable (newSubStartLabel),
                             newSubStartLabel),
                 labelToSubroutines.get(b.getLabel()));
-       }
+        }
 
         /**
          * Copies a basic block, mapping its successors along the way.
@@ -1435,7 +1435,7 @@
          * @param origLabel original block label
          * @param newLabel label that the new block should have
          */
-       private void copyBlock(int origLabel, int newLabel) {
+        private void copyBlock(int origLabel, int newLabel) {
 
             BasicBlock origBlock = labelToBlock(origLabel);
 
@@ -1515,7 +1515,7 @@
          */
         private boolean involvedInSubroutine(int label, int subroutineStart) {
             IntList subroutinesList = labelToSubroutines.get(label);
-            return (subroutinesList.size() > 0
+            return (subroutinesList != null && subroutinesList.size() > 0
                     && subroutinesList.top() == subroutineStart);
         }