private static void syncClipboardFromOS() {
if (Util.activity == null) {
return;
}
Util.activity.runOnUiThread(new Runnable() {
@Override
public void run() {
new Handler(Util.activity.getMainLooper()).postDelayed(new Runnable() {
because Util can be called from several services. While the first null check is correct, in #383 StorageService asks for some permissions, and then it nullifies Util.activity before the handler is created, causing a NPE in Util.activity.getMainLooper().
This is not safe:
because Util can be called from several services. While the first null check is correct, in #383 StorageService asks for some permissions, and then it nullifies
Util.activity
before the handler is created, causing a NPE inUtil.activity.getMainLooper()
.Therefore, a second null check is required.