Browse Source

Check null url. Fixes austinhuang0131/barinsta#1192

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
3cc4f7b7bc
  1. 9
      app/src/main/java/awais/instagrabber/dialogs/ProfilePicDialogFragment.java
  2. 3
      app/src/main/java/awais/instagrabber/repositories/responses/User.java
  3. 1
      app/src/main/res/values/strings.xml

9
app/src/main/java/awais/instagrabber/dialogs/ProfilePicDialogFragment.java

@ -134,7 +134,14 @@ public class ProfilePicDialogFragment extends DialogFragment {
@Override
public void onSuccess(final User result) {
if (result != null) {
setupPhoto(result.getHDProfilePicUrl());
final String url = result.getHDProfilePicUrl();
if (url == null) {
final Context context = getContext();
if (context == null) return;
Toast.makeText(context, R.string.no_profile_pic_found, Toast.LENGTH_LONG).show();
return;
}
setupPhoto(url);
}
}

3
app/src/main/java/awais/instagrabber/repositories/responses/User.java

@ -111,6 +111,9 @@ public class User implements Serializable {
}
public String getHDProfilePicUrl() {
if (hdProfilePicUrlInfo == null) {
return getProfilePicUrl();
}
return hdProfilePicUrlInfo.getUrl();
}

1
app/src/main/res/values/strings.xml

@ -504,4 +504,5 @@
<string name="clear">Clear</string>
<string name="no_external_map_app">No Map app found!</string>
<string name="click_to_show_full">Click to view full count</string>
<string name="no_profile_pic_found">No profile pic found!</string>
</resources>
Loading…
Cancel
Save