fix potential crashes

This commit is contained in:
Phillip Thelen 2017-01-19 13:12:30 +01:00
parent a1fa9af152
commit 5905af486b
3 changed files with 16 additions and 13 deletions

View file

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.habitrpg.android.habitica"
android:versionCode="147"
android:versionCode="148"
android:versionName="0.0.36"
android:screenOrientation="portrait"
android:installLocation="auto" >

View file

@ -112,6 +112,7 @@ public class PopupNotificationsManager {
}
HabiticaApplication.currentActivity.runOnUiThread(() -> {
if (HabiticaApplication.currentActivity == null) return;
if ((HabiticaApplication.currentActivity).isFinishing()) return;
if (this.seenNotifications == null) {

View file

@ -386,23 +386,25 @@ public class HabitRPGUser extends BaseModel {
List<Challenge> challenges = getChallengeList();
for (String s : getChallenges()) {
boolean challengeExistInDatabase = false;
if (getChallenges() != null) {
for (String s : getChallenges()) {
boolean challengeExistInDatabase = false;
for (Challenge challenge : challenges) {
if (challenge.id.equals(s)) {
challengeExistInDatabase = true;
for (Challenge challenge : challenges) {
if (challenge.id.equals(s)) {
challengeExistInDatabase = true;
break;
break;
}
}
}
if (!challengeExistInDatabase) {
Challenge challenge = new Challenge();
challenge.id = s;
challenge.user_id = id;
if (!challengeExistInDatabase) {
Challenge challenge = new Challenge();
challenge.id = s;
challenge.user_id = id;
challenges.add(challenge);
challenges.add(challenge);
}
}
}