Prevent null pointer de-referencing

Change-Id: If56a76cee9a5f9ad985019e7059e422445bdab51
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index b6c8438..564e41a 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -594,7 +594,9 @@
     const POSITION *const mv_ref = &mv_ref_search[i];
     if (is_inside(tile, mi_col, mi_row, mv_ref)) {
       const MB_MODE_INFO *const candidate =
-          &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
+          !xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]
+              ? NULL
+              : &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
 #if CONFIG_REF_MV
       if (candidate == NULL) continue;
       if ((mi_row % MAX_MIB_SIZE) + mv_ref->row >= MAX_MIB_SIZE ||
@@ -646,7 +648,9 @@
       const POSITION *mv_ref = &mv_ref_search[i];
       if (is_inside(tile, mi_col, mi_row, mv_ref)) {
         const MB_MODE_INFO *const candidate =
-            &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
+            !xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]
+                ? NULL
+                : &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
 #if CONFIG_REF_MV
         if (candidate == NULL) continue;
         if ((mi_row % MAX_MIB_SIZE) + mv_ref->row >= MAX_MIB_SIZE ||