Shutter-Android
Shutter-Android copied to clipboard
Null pointer exceptions in Builders
I have been using the lib in a couple apps of mine and I have run into NPEs.
In the builder patterns where I am doing companion.getActivity()!!, for example, could have a null activity.
One place in particular I am talking about here is:
fun runOnUI(run: () -> Unit) {
companion.getActivity()!!.runOnUiThread {
run.invoke()
}
}
Where companion.getActivity()!! is causing a NPE. Another way to run on background and UI thread? I would like to call from the thread that was called to me upon, doesn't have to be the UI thread.
I fixed the above issue with companion.getActivity()!! being null via commit: https://github.com/levibostian/Shutter-Android/commit/2aa136874a596a358b68fd1639da87958d833fdd