mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Merge branch 'no-quest-npe-fix' into 'master'
Fix a crash that occurred when no quests were available to load See merge request core-developers/forge!959
This commit is contained in:
@@ -149,7 +149,7 @@ public class QuestController {
|
||||
model.Ratings.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the my decks.
|
||||
*
|
||||
@@ -429,19 +429,25 @@ public class QuestController {
|
||||
* Reset the duels manager.
|
||||
*/
|
||||
public void resetDuelsManager() {
|
||||
|
||||
QuestWorld world = getWorld();
|
||||
String path;
|
||||
if(world.getName().equals(QuestWorld.STANDARDWORLDNAME)){
|
||||
this.duelManager = new QuestEventLDADuelManager();
|
||||
return;
|
||||
}
|
||||
if (world == null || !world.isCustom()){
|
||||
path = world == null || world.getDuelsDir() == null ? ForgeConstants.DEFAULT_DUELS_DIR : ForgeConstants.QUEST_WORLD_DIR + world.getDuelsDir();
|
||||
}else{
|
||||
path = world == null || world.getDuelsDir() == null ? ForgeConstants.DEFAULT_DUELS_DIR : ForgeConstants.USER_QUEST_WORLD_DIR + world.getDuelsDir();
|
||||
String path = ForgeConstants.DEFAULT_CHALLENGES_DIR;
|
||||
|
||||
if (world != null) {
|
||||
|
||||
if (world.getName().equals(QuestWorld.STANDARDWORLDNAME)) {
|
||||
this.duelManager = new QuestEventLDADuelManager();
|
||||
return;
|
||||
} else if (world.isCustom()) {
|
||||
path = world.getDuelsDir() == null ? ForgeConstants.DEFAULT_DUELS_DIR : ForgeConstants.USER_QUEST_WORLD_DIR + world.getDuelsDir();
|
||||
} else {
|
||||
path = world.getDuelsDir() == null ? ForgeConstants.DEFAULT_DUELS_DIR : ForgeConstants.QUEST_WORLD_DIR + world.getDuelsDir();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.duelManager = new QuestEventDuelManager(new File(path));
|
||||
|
||||
}
|
||||
|
||||
public HashSet<StarRating> GetRating() {
|
||||
@@ -453,19 +459,25 @@ public class QuestController {
|
||||
* Reset the challenges manager.
|
||||
*/
|
||||
public void resetChallengesManager() {
|
||||
|
||||
QuestWorld world = getWorld();
|
||||
String path;
|
||||
if (world.getName().equals(QuestWorld.STANDARDWORLDNAME)){
|
||||
allChallenges = QuestChallengeGenerator.generateChallenges();
|
||||
return;
|
||||
}
|
||||
if (world == null || !world.isCustom()){
|
||||
path = world == null || world.getChallengesDir() == null ? ForgeConstants.DEFAULT_CHALLENGES_DIR : ForgeConstants.QUEST_WORLD_DIR + world.getChallengesDir();
|
||||
}else{
|
||||
path = world == null || world.getChallengesDir() == null ? ForgeConstants.DEFAULT_CHALLENGES_DIR : ForgeConstants.USER_QUEST_WORLD_DIR + world.getChallengesDir();
|
||||
String path = ForgeConstants.DEFAULT_CHALLENGES_DIR;
|
||||
|
||||
if (world != null) {
|
||||
|
||||
if (world.getName().equals(QuestWorld.STANDARDWORLDNAME)) {
|
||||
allChallenges = QuestChallengeGenerator.generateChallenges();
|
||||
return;
|
||||
} else if (world.isCustom()) {
|
||||
path = world.getChallengesDir() == null ? ForgeConstants.DEFAULT_CHALLENGES_DIR : ForgeConstants.QUEST_WORLD_DIR + world.getChallengesDir();
|
||||
} else {
|
||||
path = world.getChallengesDir() == null ? ForgeConstants.DEFAULT_CHALLENGES_DIR : ForgeConstants.USER_QUEST_WORLD_DIR + world.getChallengesDir();
|
||||
}
|
||||
|
||||
}
|
||||
this.allChallenges = new StorageBase<QuestEventChallenge>("Quest Challenges", new QuestChallengeReader(new File(path)));
|
||||
|
||||
this.allChallenges = new StorageBase<>("Quest Challenges", new QuestChallengeReader(new File(path)));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user