Skip to content
Snippets Groups Projects
Commit 53487648 authored by John Carlson's avatar John Carlson
Browse files

More potential protection against null pointer exceptions when an atom feed url is not available.

parent 69501107
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -91,7 +91,7 @@ public class UserActivity extends BaseActivity {
 
if (savedInstanceState == null) {
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.user_feed, FeedFragment.newInstance(mUser.getFeedUrl().toString())).commit();
fragmentTransaction.add(R.id.user_feed, FeedFragment.newInstance(mUser.getFeedUrl())).commit();
}
}
 
Loading
Loading
Loading
Loading
@@ -54,7 +54,7 @@ public class GroupPagerAdapter extends FragmentPagerAdapter {
 
switch (position) {
case ACTIVITY_POS:
return FeedFragment.newInstance(mGroup.getFeedUrl().toString());
return FeedFragment.newInstance(mGroup.getFeedUrl());
case PROJECTS_POS:
return ProjectsFragment.newInstance(mGroup);
case MEMBERS_POS:
Loading
Loading
Loading
Loading
@@ -77,7 +77,7 @@ public class SectionsPagerAdapter extends FragmentPagerAdapter {
case OVERVIEW_POS:
return OverviewFragment.newInstance();
case ACTIVITY_POS:
return FeedFragment.newInstance(mProject.getFeedUrl().toString());
return FeedFragment.newInstance(mProject.getFeedUrl());
case FILES_POS:
return FilesFragment.newInstance();
case COMMITS_POS:
Loading
Loading
package com.commit451.gitlab.model.api;
 
import android.net.Uri;
import android.support.annotation.Nullable;
 
import com.google.gson.annotations.SerializedName;
 
Loading
Loading
@@ -188,8 +189,12 @@ public class Project {
return mOpenIssuesCount;
}
 
@Nullable
public Uri getFeedUrl() {
return Uri.parse(mWebUrl.toString() + ".atom");
if (mWebUrl == null) {
return null;
}
return Uri.parse(mWebUrl + ".atom");
}
 
public boolean belongsToGroup() {
Loading
Loading
package com.commit451.gitlab.model.api;
 
import android.net.Uri;
import android.support.annotation.Nullable;
import com.google.gson.annotations.SerializedName;
 
import org.parceler.Parcel;
 
import android.net.Uri;
@Parcel
public class UserBasic extends UserSafe {
@SerializedName("id")
Loading
Loading
@@ -35,7 +36,11 @@ public class UserBasic extends UserSafe {
return mWebUrl;
}
 
@Nullable
public Uri getFeedUrl() {
if (mWebUrl == null) {
return null;
}
return Uri.parse(mWebUrl.toString() + ".atom");
}
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment