CameraKit / blurkit-android

The missing Android blurring library. Fast blur-behind layout that parallels iOS.
MIT License
3.72k stars 309 forks source link

Use custom exception instead of runtime NullPointerException #3

Closed consp1racy closed 7 years ago

consp1racy commented 7 years ago

NPE extends RuntimeException and the IDE does not advice catching it even if a method declares it throws NullPointerException.

Seen in BlurLayout.getDownscaledBitmapForView(...)

Use something like public class NoScreenException extends Exception {...}.

dwillmc commented 7 years ago

I reused the NullPointerException because there were cases where the screenView.draw(...) method would throw it, so I was handling that anyway. Thanks for the issue, I'll address this soon and add a custom exception type.

dwillmc commented 7 years ago

Now catching the NullPointerException thrown internally to the Android APIs, and a custom BlurKitException.