Fix crashes

pull/384/head
Alex Baker 9 years ago
parent b11dfe41ab
commit 113d1dc7d2

@ -17,6 +17,8 @@ import org.tasks.preferences.Preferences;
import javax.inject.Inject;
import javax.inject.Singleton;
import static com.google.common.base.Strings.isNullOrEmpty;
/**
* Methods for working with GTasks preferences
*
@ -69,7 +71,7 @@ public class GtasksPreferenceService {
public boolean isLoggedIn() {
return context.getResources().getBoolean(R.bool.sync_enabled) &&
preferences.getBoolean(R.string.sync_gtasks, false) &&
preferences.getStringValue(PREF_USER_NAME) != null &&
!isNullOrEmpty(preferences.getStringValue(PREF_USER_NAME)) &&
permissionChecker.canAccessAccounts();
}

@ -55,9 +55,11 @@ import javax.inject.Inject;
import butterknife.Bind;
import butterknife.OnClick;
import static com.google.common.base.Predicates.notNull;
import static com.google.common.collect.Iterables.transform;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.difference;
import static com.google.common.collect.Sets.filter;
import static com.google.common.collect.Sets.newHashSet;
/**
@ -376,7 +378,7 @@ public final class TagsControlSet extends TaskEditControlFragment {
Set<TagData> selectedTags = getSelectedTags(true);
Sets.SetView<TagData> added = difference(selectedTags, existingTags);
Sets.SetView<TagData> removed = difference(existingTags, selectedTags);
deleteLinks(taskId, taskUuid, removed);
deleteLinks(taskId, taskUuid, filter(removed, notNull()));
for (TagData tagData : added) {
Metadata newLink = TaskToTagMetadata.newTagMetadata(taskId, taskUuid, tagData.getName(), tagData.getUuid());
metadataDao.createNew(newLink);

Loading…
Cancel
Save