NullPointerException
See original GitHub issueHello,
I’m receiving this issue from fabric crashlytics. I am using version “2.2.6”. I cannot trace the issue myself and only have reports from crashlytics about it.
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isRecycled()' on a null object reference
at com.qozix.tileview.graphics.BitmapRecyclerDefault.recycleBitmap(Unknown Source)
at com.qozix.tileview.tiles.Tile.reset(Unknown Source)
at com.qozix.tileview.tiles.TileRenderRunnable.renderTile(Unknown Source)
at com.qozix.tileview.tiles.TileRenderRunnable.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:776)
It seems that the bitmap object passed to recycleBitmap method in BitmapRecyclerDefault class is null. So when calling if( !bitmap.isRecycled() )
it produces NullPointerException.
public class BitmapRecyclerDefault implements BitmapRecycler {
@Override
public void recycleBitmap( Bitmap bitmap ) {
if( !bitmap.isRecycled() ) {
bitmap.recycle();
}
}
}
Any help would be greatly appreciated.
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
NullPointerException (Java Platform SE 7 ) - Oracle Help Center
Thrown when an application attempts to use null in a case where an object is required. These include: ... Applications should throw instances...
Read more >java - What is a NullPointerException, and how do I fix it?
NullPointerException s are exceptions that occur when you try to use a reference that points to no location in memory ...
Read more >Null Pointer Exception In Java - GeeksforGeeks
NullPointerException is a RuntimeException. In Java, a special null value can be assigned to an object reference. NullPointerException is thrown ...
Read more >Java NullPointerException - Detect, Fix, and Best Practices
NullPointerException is a runtime exception, so we don't need to catch it in the program. NullPointerException is raised in an application ...
Read more >Preventing NullPointerException - Wikibooks, open books for ...
NullPointerException is a RuntimeException . In Java, a special null value can be assigned to an object reference. NullPointerException is thrown when an ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That must be the issue. We might call recycle in few places, I will check them. Thank you so much for the quick response! Have a nice day.
After analysis, a
Tile
object is only given a reference to aBitmap
object in theTile.generateBitmap
method :So if the
BitmapProvider
--or any other object involved (which is implemented user side) recycles theBitmap
between the null check and theBitmapRecycler.recycleBitmap()
call (inTile.reset()
, we’ve got a NullPointerException.As a consequence, i think the fix would be to add a try catch in the
BitmapRecyclerDefault
. But, to fix your issue quickly, you can set your ownBitmapRecycler
like this :