Fix Crash when importing deck

removed "sideboard"
This commit is contained in:
Anthony Calosa
2016-07-11 16:35:57 +08:00
committed by GitHub
parent 6d4a068453
commit 5cde230723

View File

@@ -34,21 +34,18 @@ public class DeckImporter
{
while (scanner.hasNext())
{
boolean foundSideboard = false;
String line = scanner.nextLine();
if(line.toLowerCase().contains("sideboard"))
foundSideboard = true;
line = line.trim();
if (!line.equals("")) // don't write out blank lines
{
String[] slines = line.split("\\s+");
String arranged = "";
for(int idx = 1; idx < slines.length; idx++)
{
arranged += slines[idx] + " ";
}
if ((isNumeric(slines[0])||foundSideboard) && arranged != null)
if ((isNumeric(slines[0])) && arranged != null)
{
if (foundSideboard)
deck += prefix;
if (slines[1] != null && slines[1].startsWith("["))
{
arranged = arranged.substring(5);
@@ -61,6 +58,7 @@ public class DeckImporter
}
}
}
}
File profile = new File(activePath+"/Res/settings/options.txt");
if(profile.exists() && !profile.isDirectory())
{
@@ -87,14 +85,11 @@ public class DeckImporter
if (!toSave.exists()) {
toSave.createNewFile();
}
// get the content in bytes
byte[] contentInBytes = deck.getBytes();
fop.write(contentInBytes);
fop.flush();
fop.close();
message = "Import Deck Success!\n\n"+deck;
}
catch (IOException e)