am 31a69fdb: throw if we have a null typeface native instance (so we don\'t crash in native code) we may still have to native-destroy a Typeface with a null ref, so check for that

Merge commit '31a69fdbe1edd8d686043e8ca7d278289f65808e' into eclair-mr2-plus-aosp

* commit '31a69fdbe1edd8d686043e8ca7d278289f65808e':
  throw if we have a null typeface native instance (so we don't crash in native code)
This commit is contained in:
Mike Reed
2009-12-17 09:24:18 -08:00
committed by Android Git Automerger
2 changed files with 4 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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;
}