diff --git a/app/src/main/java/net/schueller/peertube/activity/SettingsActivity.java b/app/src/main/java/net/schueller/peertube/activity/SettingsActivity.java
index 33755b3..f4070fd 100644
--- a/app/src/main/java/net/schueller/peertube/activity/SettingsActivity.java
+++ b/app/src/main/java/net/schueller/peertube/activity/SettingsActivity.java
@@ -10,7 +10,10 @@ import android.preference.Preference;
import android.support.v7.app.ActionBar;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
+import android.util.Patterns;
import android.view.MenuItem;
+import android.widget.Toast;
+
import net.schueller.peertube.R;
import java.util.List;
@@ -34,6 +37,12 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = (preference, value) -> {
String stringValue = value.toString();
+ // check URL is valid
+ if (preference.getKey().equals("pref_api_base") && !Patterns.WEB_URL.matcher(stringValue).matches()) {
+ Toast.makeText(preference.getContext(), R.string.invalid_url, Toast.LENGTH_LONG).show();
+ return false;
+ }
+
preference.setSummary(stringValue);
return true;
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5ceebec..9a0fbc8 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -59,5 +59,6 @@
More
Share
PeerTube
+ Invalid Url!