Error Resilience - Check on as_recent_fld[0][1]

If it is NULL then it should first get assigned to a value before dereferencing
Adding check for the same.

Bug: 34231231
Change-Id: I8ed89ea791d78d5fa8e35d123a92866b3da1ceb1
(cherry picked from commit a8dbcd2b5c956a45a848a332c35909ad58c6a2a9)
diff --git a/decoder/impeg2d_pic_proc.c b/decoder/impeg2d_pic_proc.c
index 029f1bf..fbbbf79 100644
--- a/decoder/impeg2d_pic_proc.c
+++ b/decoder/impeg2d_pic_proc.c
@@ -555,6 +555,32 @@
             ps_dec->as_recent_fld[1][1] = ps_dec->as_recent_fld[0][1];
         }
 
+        /* Error resilience: If forward and backward pictures are going to be NULL*/
+        /* then assign both to the current                                        */
+        /* if one of them NULL then we will assign the non null to the NULL one   */
+
+        if((NULL == ps_dec->as_recent_fld[0][1].pu1_y) && (NULL == ps_dec->as_recent_fld[1][1].pu1_y))
+        {
+            // assign the current picture to both
+            ps_dec->as_recent_fld[1][0] = ps_dec->s_cur_frm_buf;
+            impeg2d_get_bottom_field_buf(&ps_dec->s_cur_frm_buf, &ps_dec->as_recent_fld[1][1],
+                                         ps_dec->u2_frame_width);
+            ps_dec->as_recent_fld[0][0] = ps_dec->s_cur_frm_buf;
+            ps_dec->as_recent_fld[0][1] = ps_dec->as_recent_fld[1][1];
+        }
+        //Assign the non-null picture to the null picture
+
+        else if((NULL == ps_dec->as_recent_fld[0][1].pu1_y) && (NULL != ps_dec->as_recent_fld[1][1].pu1_y))
+        {
+            ps_dec->as_recent_fld[0][0] = ps_dec->as_recent_fld[1][0];
+            ps_dec->as_recent_fld[0][1] = ps_dec->as_recent_fld[1][1];
+        }
+
+        else if((NULL == ps_dec->as_recent_fld[1][1].pu1_y) && (NULL != ps_dec->as_recent_fld[0][1].pu1_y))
+        {
+            ps_dec->as_recent_fld[1][0] = ps_dec->as_recent_fld[0][0];
+            ps_dec->as_recent_fld[1][1] = ps_dec->as_recent_fld[0][1];
+        }
         ps_dec->as_ref_buf[FORW][TOP]    = ps_dec->as_recent_fld[0][0];
         ps_dec->as_ref_buf[FORW][BOTTOM] = ps_dec->as_recent_fld[0][1];
         ps_dec->as_ref_buf[BACK][TOP]    = ps_dec->as_recent_fld[1][0];