Browse Source

fix size comparison & handle empty paths list

renovate/org.robolectric-robolectric-4.x
tcely 4 years ago
parent
commit
9a889ef385
No known key found for this signature in database GPG Key ID: E361829E1B3040DB
  1. 8
      app/src/main/java/awais/instagrabber/utils/IntentUtils.java

8
app/src/main/java/awais/instagrabber/utils/IntentUtils.java

@ -21,8 +21,12 @@ public final class IntentUtils {
// final boolean isHttpsUri = "https".equals(parsedUrl.getScheme());
final List<String> paths = parsedUrl.getPathSegments();
String path = paths.get(0);
if (paths.isEmpty()) {
return null;
}
String path = paths.get(0);
String text = null;
IntentModelType type = IntentModelType.UNKNOWN;
if (1 == paths.size()) {
@ -34,7 +38,7 @@ public final class IntentUtils {
} else if ("p".equals(path) || "reel".equals(path) || "tv".equals(path)) {
text = paths.get(1);
type = IntentModelType.POST;
} else if (2 >= paths.size() && "explore".equals(path)) {
} else if (2 < paths.size() && "explore".equals(path)) {
path = paths.get(1);
if ("locations".equals(path)) {

Loading…
Cancel
Save