From 5f0853a56d5214ab1c9d4238c500c8433d64e28e Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 13 Sep 2016 17:39:00 -0700 Subject: Fix error if adding a user with no current users --- app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java | 2 +- app/src/main/java/github/daneren2005/dsub/util/UserUtil.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app/src/main') 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 { 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); -- cgit v1.2.3