Made invalid legacy maps be properly discarded
This commit is contained in:
@@ -167,6 +167,10 @@ public class ContentLoader{
|
||||
public <T extends Content> T getByID(ContentType type, int id){
|
||||
|
||||
if(temporaryMapper != null && temporaryMapper[type.ordinal()] != null && temporaryMapper[type.ordinal()].length != 0){
|
||||
//-1 = invalid content
|
||||
if(id < 0){
|
||||
return null;
|
||||
}
|
||||
if(temporaryMapper[type.ordinal()].length <= id || temporaryMapper[type.ordinal()][id] == null){
|
||||
return getByID(type, 0); //default value is always ID 0
|
||||
}
|
||||
|
||||
@@ -162,12 +162,12 @@ public class Maps implements Disposable{
|
||||
for(FileHandle file : customMapDirectory.list()){
|
||||
if(file.extension().equalsIgnoreCase(oldMapExtension)){
|
||||
try{
|
||||
convertedAny = true;
|
||||
LegacyMapIO.convertMap(file, file.sibling(file.nameWithoutExtension() + "." + mapExtension));
|
||||
//delete old, converted file; it is no longer useful
|
||||
file.delete();
|
||||
convertedAny = true;
|
||||
Log.info("Converted file {0}", file);
|
||||
}catch(IOException e){
|
||||
}catch(Exception e){
|
||||
//rename the file to a 'mmap_conversion_failed' extension to keep it there just in case
|
||||
//but don't delete it
|
||||
file.copyTo(file.sibling(file.name() + "_conversion_failed"));
|
||||
|
||||
Reference in New Issue
Block a user