Commit c2daf399 by Sebastián Katzer

Only exec callbacks if they are not null or empty

parent 97f54d9e
...@@ -38,6 +38,7 @@ import android.content.Context; ...@@ -38,6 +38,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
/** /**
* The alarm receiver is triggered when a scheduled alarm is fired. This class * The alarm receiver is triggered when a scheduled alarm is fired. This class
...@@ -181,7 +182,7 @@ public class Receiver extends BroadcastReceiver { ...@@ -181,7 +182,7 @@ public class Receiver extends BroadcastReceiver {
// after reboot, LocalNotification.webView is always null // after reboot, LocalNotification.webView is always null
// may be call foreground callback later // may be call foreground callback later
if (function != null && LocalNotification.webView != null) { if (!TextUtils.isEmpty(function) && LocalNotification.webView != null) {
LocalNotification.webView.sendJavascript(function + "(" + options.getId() + ")"); LocalNotification.webView.sendJavascript(function + "(" + options.getId() + ")");
} }
} }
......
...@@ -28,6 +28,7 @@ import android.app.Activity; ...@@ -28,6 +28,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
public class ReceiverActivity extends Activity { public class ReceiverActivity extends Activity {
...@@ -74,7 +75,7 @@ public class ReceiverActivity extends Activity { ...@@ -74,7 +75,7 @@ public class ReceiverActivity extends Activity {
// after reboot, LocalNotification.webView is always null // after reboot, LocalNotification.webView is always null
// may be call background callback later // may be call background callback later
if (function != null && LocalNotification.webView != null) { if (!TextUtils.isEmpty(function) && LocalNotification.webView != null) {
LocalNotification.webView.sendJavascript("setTimeout('" + function + "(" + options.getId() + ")',0)"); LocalNotification.webView.sendJavascript("setTimeout('" + function + "(" + options.getId() + ")',0)");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment