aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-09-13 17:39:00 -0700
committerScott Jackson <daneren2005@gmail.com>2016-09-13 17:39:00 -0700
commit5f0853a56d5214ab1c9d4238c500c8433d64e28e (patch)
tree78d1853acabc806017f19a12bb51f5bf73e07c5d /app/src/main/java/github
parent328d80f0dfd9c6057e65b948b9bd9d52968cc4a8 (diff)
downloaddsub-5f0853a56d5214ab1c9d4238c500c8433d64e28e.tar.gz
dsub-5f0853a56d5214ab1c9d4238c500c8433d64e28e.tar.bz2
dsub-5f0853a56d5214ab1c9d4238c500c8433d64e28e.zip
Fix error if adding a user with no current users
Diffstat (limited to 'app/src/main/java/github')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/UserUtil.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java
index 187f0d55..552712f7 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java
@@ -47,7 +47,7 @@ public class AdminFragment extends SelectRecyclerFragment<User> {
switch (item.getItemId()) {
case R.id.menu_add_user:
- UserUtil.addNewUser(context, this, objects.get(0));
+ UserUtil.addNewUser(context, this, (objects.size() > 0) ? objects.get(0) : null);
break;
}
diff --git a/app/src/main/java/github/daneren2005/dsub/util/UserUtil.java b/app/src/main/java/github/daneren2005/dsub/util/UserUtil.java
index 24d3906b..db1c628f 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/UserUtil.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/UserUtil.java
@@ -406,7 +406,7 @@ public final class UserUtil {
}
}
- if(sampleUser.getMusicFolderSettings() != null) {
+ if(sampleUser != null && sampleUser.getMusicFolderSettings() != null) {
for(User.Setting setting: sampleUser.getMusicFolderSettings()) {
User.MusicFolderSetting musicFolderSetting = (User.MusicFolderSetting) setting;
user.addMusicFolder(musicFolderSetting, true);