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);
|
model.Ratings.add(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the my decks.
|
* Gets the my decks.
|
||||||
*
|
*
|
||||||
@@ -429,19 +429,25 @@ public class QuestController {
|
|||||||
* Reset the duels manager.
|
* Reset the duels manager.
|
||||||
*/
|
*/
|
||||||
public void resetDuelsManager() {
|
public void resetDuelsManager() {
|
||||||
|
|
||||||
QuestWorld world = getWorld();
|
QuestWorld world = getWorld();
|
||||||
String path;
|
String path = ForgeConstants.DEFAULT_CHALLENGES_DIR;
|
||||||
if(world.getName().equals(QuestWorld.STANDARDWORLDNAME)){
|
|
||||||
this.duelManager = new QuestEventLDADuelManager();
|
if (world != null) {
|
||||||
return;
|
|
||||||
}
|
if (world.getName().equals(QuestWorld.STANDARDWORLDNAME)) {
|
||||||
if (world == null || !world.isCustom()){
|
this.duelManager = new QuestEventLDADuelManager();
|
||||||
path = world == null || world.getDuelsDir() == null ? ForgeConstants.DEFAULT_DUELS_DIR : ForgeConstants.QUEST_WORLD_DIR + world.getDuelsDir();
|
return;
|
||||||
}else{
|
} else if (world.isCustom()) {
|
||||||
path = world == null || world.getDuelsDir() == null ? ForgeConstants.DEFAULT_DUELS_DIR : ForgeConstants.USER_QUEST_WORLD_DIR + world.getDuelsDir();
|
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));
|
this.duelManager = new QuestEventDuelManager(new File(path));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashSet<StarRating> GetRating() {
|
public HashSet<StarRating> GetRating() {
|
||||||
@@ -453,19 +459,25 @@ public class QuestController {
|
|||||||
* Reset the challenges manager.
|
* Reset the challenges manager.
|
||||||
*/
|
*/
|
||||||
public void resetChallengesManager() {
|
public void resetChallengesManager() {
|
||||||
|
|
||||||
QuestWorld world = getWorld();
|
QuestWorld world = getWorld();
|
||||||
String path;
|
String path = ForgeConstants.DEFAULT_CHALLENGES_DIR;
|
||||||
if (world.getName().equals(QuestWorld.STANDARDWORLDNAME)){
|
|
||||||
allChallenges = QuestChallengeGenerator.generateChallenges();
|
if (world != null) {
|
||||||
return;
|
|
||||||
}
|
if (world.getName().equals(QuestWorld.STANDARDWORLDNAME)) {
|
||||||
if (world == null || !world.isCustom()){
|
allChallenges = QuestChallengeGenerator.generateChallenges();
|
||||||
path = world == null || world.getChallengesDir() == null ? ForgeConstants.DEFAULT_CHALLENGES_DIR : ForgeConstants.QUEST_WORLD_DIR + world.getChallengesDir();
|
return;
|
||||||
}else{
|
} else if (world.isCustom()) {
|
||||||
path = world == null || world.getChallengesDir() == null ? ForgeConstants.DEFAULT_CHALLENGES_DIR : ForgeConstants.USER_QUEST_WORLD_DIR + world.getChallengesDir();
|
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