Merge "Fixed LinearBlock thumbnail crash issue" into main am: 5d1e90cd61

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/3351159

Change-Id: Id6321a36b334d9550a0011430f1359e329110889
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index efbd682..35370e7 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -6093,9 +6093,9 @@
         }
         if (csd->size() == 0) {
             ALOGW("csd-%zu size is 0", i);
+        } else {
+            mCSD.push_back(csd);
         }
-
-        mCSD.push_back(csd);
         ++i;
     }