r1425 MapTileProviderBase NullPointerException
Closed this issue · 4 comments
GoogleCodeExporter commented
Hi,
Regarding r1425 "Avoid repeated casting" in class MapTileProviderBase
at line 349 there can be NullPointerException if isReusable=false
because reusableBitmapDrawable in that case is null.
Best regards, Emux
https://play.google.com/store/apps/details?id=gr.talent.cruiser
Original issue reported on code.google.com by devemu...@gmail.com
on 27 Jan 2014 at 10:06
GoogleCodeExporter commented
Maybe I'm not seeing it, but firstly I didn't change the logic (AFAIK), and
secondly, if the bitmap is not a ReusableBitmapDrawable then !isResuable is
true so it won't evaluate reusableBitmapDrawable.isBitmapValid()
Original comment by neilboyd
on 31 Jan 2014 at 5:52
GoogleCodeExporter commented
Hi Neil,
If the bitmap is not a ReusableBitmapDrawable then !isResuable is true,
so yes it won't evaluate reusableBitmapDrawable.isBitmapValid()
But it will enter the if block and there at line 349 it will process the
final Bitmap oldBitmap = reusableBitmapDrawable.getBitmap();
where it'll throw a NPE as reusableBitmapDrawable is null.
The old code at line 349 works correctly:
final Bitmap oldBitmap = ((BitmapDrawable) oldDrawable).getBitmap();
Best regards, Emux
https://play.google.com/store/apps/details?id=gr.talent.cruiser
Original comment by devemu...@gmail.com
on 31 Jan 2014 at 7:26
GoogleCodeExporter commented
Oh, I see, I changed the code - it was a cast to a plain BitmapDrawable.
I'll fix it.
Original comment by neilboyd
on 31 Jan 2014 at 8:20
- Changed state: Accepted
GoogleCodeExporter commented
This issue was closed by revision r1427.
Original comment by neilboyd
on 31 Jan 2014 at 8:57
- Changed state: Fixed