Fix JNI work around for IRT removal

If we are in work around mode AND we have an invalid reference, try to
compute its index. Previous code would unconditionally try to look up
indexes for all references even if they weren't invalid.

Change-Id: I606689961f9aee6e5eba0ac8e15a1b8b2fc505b7
diff --git a/src/indirect_reference_table.cc b/src/indirect_reference_table.cc
index 951cf37..6eeb94a 100644
--- a/src/indirect_reference_table.cc
+++ b/src/indirect_reference_table.cc
@@ -247,7 +247,7 @@
     LOG(WARNING) << "Attempt to remove local SIRT entry from IRT, ignoring";
     return true;
   }
-  if (GetIndirectRefKind(iref) == kSirtOrInvalid || vm->work_around_app_jni_bugs) {
+  if (GetIndirectRefKind(iref) == kSirtOrInvalid && vm->work_around_app_jni_bugs) {
     Object* direct_pointer = reinterpret_cast<Object*>(iref);
     idx = Find(direct_pointer, bottomIndex, topIndex, table_);
     if (idx == -1) {