diff --git a/src/android/nl/xservices/plugins/Toast.java b/src/android/nl/xservices/plugins/Toast.java index 387ec03..6d44a77 100644 --- a/src/android/nl/xservices/plugins/Toast.java +++ b/src/android/nl/xservices/plugins/Toast.java @@ -30,6 +30,7 @@ public class Toast extends CordovaPlugin { toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0); } else { callbackContext.error("invalid position. valid options are 'top', 'center' and 'bottom'"); + return; } if ("short".equals(duration)) { @@ -38,6 +39,7 @@ public class Toast extends CordovaPlugin { toast.setDuration(android.widget.Toast.LENGTH_LONG); } else { callbackContext.error("invalid duration. valid options are 'short' and 'long'"); + return; } toast.show(); @@ -51,4 +53,4 @@ public class Toast extends CordovaPlugin { return false; } } -} \ No newline at end of file +}