Prevent crash

This commit is contained in:
M66B
2022-05-11 09:13:47 +02:00
parent d488470451
commit 27330ceddc

View File

@@ -104,7 +104,12 @@ public class UriHelper {
return null;
if (tld.equals(host))
return null;
int dot = host.substring(0, host.length() - tld.length() - 1).lastIndexOf('.');
int len = host.length() - tld.length() - 1;
if (len < 0) {
Log.e("getRootDomain host=" + host + " tld=" + tld);
return host;
}
int dot = host.substring(0, len).lastIndexOf('.');
if (dot < 0)
return host;
return host.substring(dot + 1);