cats-oss / android-gpuimage

Android filters based on OpenGL (idea from GPUImage for iOS)
9k stars 2.27k forks source link

Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' #331

Open MaSiYuan opened 7 years ago

MaSiYuan commented 7 years ago

I was just doing something like this: Uri imageUri = ...; mGPUImage = new GPUImage(context); mGPUImage.setFilter(new GPUImageSobelEdgeDetection()); mGPUImage.setImage(imageUri); mGPUImage.saveToPictures("GPUImage", "ImageWithFilter.jpg", null);

but error occured: E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #5 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at jp.co.cyberagent.android.gpuimage.GPUImage.getBitmapWithFilterApplied(GPUImage.java:308) at jp.co.cyberagent.android.gpuimage.GPUImage$SaveTask.doInBackground(GPUImage.java:451) at jp.co.cyberagent.android.gpuimage.GPUImage$SaveTask.doInBackground(GPUImage.java:431) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  at java.lang.Thread.run(Thread.java:818) 

developer-- commented 7 years ago

same problem

abi98213 commented 4 years ago

Any update, I am getting the same crash. Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at jp.co.cyberagent.android.gpuimage.GPUImage.getBitmapWithFilterApplied(GPUImage.java:8) at jp.co.cyberagent.android.gpuimage.GPUImage.getBitmapWithFilterApplied(GPUImage.java:1) at com.vyroai.AiBlurEditor.blurTypes.applyBlurTypes.applyBlur(applyBlurTypes.java:10) at com.vyroai.AiBlurEditor.Utils.blurAsync.doInBackground(blurAsync.java:1) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)