summaryrefslogtreecommitdiffstats
path: root/core/jni/android
diff options
context:
space:
mode:
authorBo Liu <boliu@google.com>2014-11-25 16:59:27 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-25 16:59:27 +0000
commit3813430367591efcf925b2baebc50a99a7666644 (patch)
tree95a0c26064767dde538959ce4808cb9de3b2b42b /core/jni/android
parentf2a382d4f7de5336d0c20358bb694e205a38fc38 (diff)
parent84be180e97f920a9400789368a6bc54c5a9b90d8 (diff)
downloadframeworks_base-3813430367591efcf925b2baebc50a99a7666644.zip
frameworks_base-3813430367591efcf925b2baebc50a99a7666644.tar.gz
frameworks_base-3813430367591efcf925b2baebc50a99a7666644.tar.bz2
am 84be180e: Merge "Fix crash in getNativeCanvas when canvasHandle is NULL" into lmp-mr1-dev
* commit '84be180e97f920a9400789368a6bc54c5a9b90d8': 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;