Last active
December 12, 2015 10:19
-
-
Save dcartoon/4758703 to your computer and use it in GitHub Desktop.
Code snippet that causes a NullPointerException in ProGuard 4.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Bitmap overlayBitmap(Bitmap bitmap , Bitmap overlay, float overlayRatio) { | |
Bitmap outputBitmap = null; | |
Bitmap resizedOverlay = null; | |
try { | |
if (null == bitmap || null == overlay) { | |
return overlay; | |
} | |
... | |
Canvas cs = new Canvas(outputBitmap); | |
try { | |
cs = null; | |
} catch (Throwable thr) { | |
//log | |
} finally { | |
if (null != resizedOverlay) { | |
try { | |
resizedOverlay.recycle(); | |
} catch (Throwable thr) { | |
} finally { | |
// If we move this statement out of its finally and remove the finally, | |
// then ProGuard does not throw an exception | |
resizedOverlay = null; | |
} | |
} | |
} | |
return outputBitmap; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment