OSDN Git Service

Fixed a native crash due to deref of a NULL pointer
authorJames Dong <jdong@google.com>
Fri, 14 Sep 2012 22:34:35 +0000 (15:34 -0700)
committerJames Dong <jdong@google.com>
Fri, 14 Sep 2012 22:34:35 +0000 (15:34 -0700)
We only checked the mNativeWindow against NULL, but did not check the native window object itself against NULL.

o related-to-bug: 7153683

Change-Id: I430d344dc09a2fc337bf51001551627056713773

media/libmediaplayerservice/nuplayer/NuPlayer.cpp

index dc1e351..1ddf775 100644 (file)
@@ -963,7 +963,8 @@ sp<AMessage> NuPlayer::Source::getFormat(bool audio) {
 
 status_t NuPlayer::setVideoScalingMode(int32_t mode) {
     mVideoScalingMode = mode;
-    if (mNativeWindow != NULL) {
+    if (mNativeWindow != NULL
+            && mNativeWindow->getNativeWindow() != NULL) {
         status_t ret = native_window_set_scaling_mode(
                 mNativeWindow->getNativeWindow().get(), mVideoScalingMode);
         if (ret != OK) {