ART: Fix SelectKind to work with nullptr
This patch fixes SelectKind to return kSelectNone
when MIR is nullptr to avoid segmentation fault.
Change-Id: I174ff5c153e03c1a1e2ef8bc68f7fb50e8a9bf3f
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc
index dac71f6..20bc220 100644
--- a/compiler/dex/mir_optimization.cc
+++ b/compiler/dex/mir_optimization.cc
@@ -186,6 +186,10 @@
}
static SelectInstructionKind SelectKind(MIR* mir) {
+ // Work with the case when mir is nullptr.
+ if (mir == nullptr) {
+ return kSelectNone;
+ }
switch (mir->dalvikInsn.opcode) {
case Instruction::MOVE:
case Instruction::MOVE_OBJECT: