avoid null dereference
fix a null pointer dereference exposed during 64-bit testing; caused a
crash at the end of recording video. I would have expected a similiar failure
in 32-bit mode, but suspect some code generation + inlining difference optimized
away the dereference in 32-bit mode. Have not identified just where that
happens.
Bug: 16890215
Test: record videos in both 32- and 64-bit modes
diff --git a/media/libstagefright/MediaCodecSource.cpp b/media/libstagefright/MediaCodecSource.cpp
index 5852dd4..cf800b2 100644
--- a/media/libstagefright/MediaCodecSource.cpp
+++ b/media/libstagefright/MediaCodecSource.cpp
@@ -643,7 +643,9 @@
if (mStopping && reachedEOS) {
ALOGI("encoder (%s) stopped", mIsVideo ? "video" : "audio");
- mPuller->stopSource();
+ if (mPuller != NULL) {
+ mPuller->stopSource();
+ }
ALOGV("source (%s) stopped", mIsVideo ? "video" : "audio");
// posting reply to everyone that's waiting
List<sp<AReplyToken>>::iterator it;