summaryrefslogtreecommitdiffstats
path: root/core/jni/android
diff options
context:
space:
mode:
authorBo Liu <boliu@google.com>2014-11-25 18:46:04 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-25 18:46:04 +0000
commit88309159a53ceb4f34fe01056521e4b84e848ef7 (patch)
tree54e2c7ea1dea6cf510996b3b493d28f3201942a9 /core/jni/android
parentaf3efb4a9ea9eafc86888be48c88fe638a22c7e9 (diff)
parent3813430367591efcf925b2baebc50a99a7666644 (diff)
downloadframeworks_base-88309159a53ceb4f34fe01056521e4b84e848ef7.zip
frameworks_base-88309159a53ceb4f34fe01056521e4b84e848ef7.tar.gz
frameworks_base-88309159a53ceb4f34fe01056521e4b84e848ef7.tar.bz2
am 38134303: am 84be180e: Merge "Fix crash in getNativeCanvas when canvasHandle is NULL" into lmp-mr1-dev
* commit '3813430367591efcf925b2baebc50a99a7666644': Fix crash in getNativeCanvas when canvasHandle is NULL
Diffstat (limited to 'core/jni/android')
-rw-r--r--core/jni/android/graphics/Graphics.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index d7b75db..2eccfbd 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -365,6 +365,9 @@ SkCanvas* GraphicsJNI::getNativeCanvas(JNIEnv* env, jobject canvas) {
SkASSERT(canvas);
SkASSERT(env->IsInstanceOf(canvas, gCanvas_class));
jlong canvasHandle = env->GetLongField(canvas, gCanvas_nativeInstanceID);
+ if (!canvasHandle) {
+ return NULL;
+ }
SkCanvas* c = reinterpret_cast<android::Canvas*>(canvasHandle)->getSkCanvas();
SkASSERT(c);
return c;