zetbaitsu / Compressor

An android image compression library.
7.09k stars 963 forks source link

Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isMutable()' on a null object reference #19

Open merlinJie opened 8 years ago

merlinJie commented 8 years ago

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isMutable()' on a null object reference at android.graphics.Canvas.(Canvas.java:149) at id.zelory.compressor.ImageUtil.getScaledBitmap(SourceFile:94) at id.zelory.compressor.Compressor.compressToBitmap(SourceFile:47)

programmerr47 commented 8 years ago

+1.

Happens when trying to created new bitmap and failed to do that, because of OOM. So in some cases scaleBitmap is null, but we pass it to constructor of Canvas and so we receive this NPE

programmerr47 commented 8 years ago

@zetbaitsu Hi, could you, please, fix it somehow.

vivian688 commented 7 years ago

this is also my question,can you tell me how to fix it?