mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-21 21:29:00 +00:00
fix some crashes
This commit is contained in:
parent
af833cb138
commit
2d603ff5c3
2 changed files with 10 additions and 2 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package com.habitrpg.android.habitica.helpers;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -41,7 +43,10 @@ public class TaskFilterHelper {
|
|||
|
||||
public List<Task> filter(List<Task> tasks) {
|
||||
List<Task> filtered = new ArrayList<>();
|
||||
String activeFilter = activeFilters.get(tasks.get(0).type);
|
||||
String activeFilter = null;
|
||||
if (activeFilters != null && activeFilters.size() > 0) {
|
||||
activeFilter = activeFilters.get(tasks.get(0).type);
|
||||
}
|
||||
for (Task task : tasks) {
|
||||
if (isFiltered(task, activeFilter)) {
|
||||
filtered.add(task);
|
||||
|
|
@ -51,7 +56,7 @@ public class TaskFilterHelper {
|
|||
return filtered;
|
||||
}
|
||||
|
||||
private boolean isFiltered(Task task, String activeFilter) {
|
||||
private boolean isFiltered(Task task, @Nullable String activeFilter) {
|
||||
if (!task.containsAllTagIds(tagsId)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,6 +351,9 @@ public class HabitRPGUser extends BaseModel {
|
|||
@Override
|
||||
public void save() {
|
||||
// We need to set the user_id to all other objects
|
||||
if (id == null) {
|
||||
return;
|
||||
}
|
||||
preferences.user_id = id;
|
||||
stats.id = id;
|
||||
profile.user_Id = id;
|
||||
|
|
|
|||
Loading…
Reference in a new issue