diff options
author | Bo Liu <boliu@google.com> | 2014-11-24 10:53:52 -0800 |
---|---|---|
committer | Bo Liu <boliu@google.com> | 2014-11-24 11:25:45 -0800 |
commit | de92f4c72be8537d2efff6024390b9ab706286e1 (patch) | |
tree | 63a7902d20b162c6293a198c3d1ce297186e3ce2 /core/jni | |
parent | b5686d55963e76c801ca0581a1012c5f4aa8d009 (diff) | |
download | frameworks_base-de92f4c72be8537d2efff6024390b9ab706286e1.zip frameworks_base-de92f4c72be8537d2efff6024390b9ab706286e1.tar.gz frameworks_base-de92f4c72be8537d2efff6024390b9ab706286e1.tar.bz2 |
Fix crash in getNativeCanvas when canvasHandle is NULL
BUG: 18261928
Change-Id: I01a5af201fe829d5752433e1bb0db7edc01733d4
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android/graphics/Graphics.cpp | 3 |
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; |