diff options
-rw-r--r-- | core/jni/android/graphics/Typeface.cpp | 2 | ||||
-rw-r--r-- | graphics/java/android/graphics/Typeface.java | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/core/jni/android/graphics/Typeface.cpp b/core/jni/android/graphics/Typeface.cpp index 238ece1..7c7bfeb 100644 --- a/core/jni/android/graphics/Typeface.cpp +++ b/core/jni/android/graphics/Typeface.cpp @@ -46,7 +46,7 @@ static SkTypeface* Typeface_createFromTypeface(JNIEnv* env, jobject, SkTypeface* } static void Typeface_unref(JNIEnv* env, jobject obj, SkTypeface* face) { - face->unref(); + SkSafeUnref(face); } static int Typeface_getStyle(JNIEnv* env, jobject obj, SkTypeface* face) { diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java index f0d5a6a..bc92d3a 100644 --- a/graphics/java/android/graphics/Typeface.java +++ b/graphics/java/android/graphics/Typeface.java @@ -143,6 +143,9 @@ public class Typeface { // don't allow clients to call this directly private Typeface(int ni) { + if (0 == ni) { + throw new RuntimeException("native typeface cannot be made"); + } native_instance = ni; } |