Skip to content

Commit

Permalink
jni:Fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiao committed Jan 15, 2014
1 parent 841edcd commit 1d5b16a
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class NativeBitmapFactory {
}
}

// Log.e("NativeBitmapFactory", "loaded" + nativeLibLoaded);
//Log.e("NativeBitmapFactory", "loaded" + nativeLibLoaded);
}

static void initField() {
Expand Down Expand Up @@ -125,14 +125,12 @@ public static void recycle(Bitmap bitmap) {
}

public static Bitmap createBitmap(int width, int height, Bitmap.Config config, boolean hasAlpha) {
if (!nativeLibLoaded) {
if (nativeLibLoaded == false || nativeIntField == null) {
//Log.e("NativeBitmapFactory", "ndk bitmap create failed");
return Bitmap.createBitmap(width, height, config);
}

int nativeConfig = getNativeConfig(config);
if (nativeConfig == 0) {
return Bitmap.createBitmap(width, height, config);
}
//Log.e("NativeBitmapFactory", "nativeConfig:"+nativeConfig);
return android.os.Build.VERSION.SDK_INT == 19 ? createBitmap19(width, height, nativeConfig, hasAlpha) : createBitmap(width, height, nativeConfig, hasAlpha);
}

Expand Down

0 comments on commit 1d5b16a

Please sign in to comment.