Crash fixes

This commit is contained in:
Anuken 2019-09-16 17:26:39 -04:00
parent 3435132e87
commit 4b824f7a4c
2 changed files with 19 additions and 1 deletions

View File

@ -373,7 +373,9 @@ public class Control implements ApplicationListener, Loadable{
public void update(){
saves.update();
//update and load any requested assets
assets.update();
if(assets != null){
assets.update();
}
input.updateController();

View File

@ -5,6 +5,7 @@ import io.anuke.arc.assets.loaders.*;
import io.anuke.arc.assets.loaders.resolvers.*;
import io.anuke.arc.collection.*;
import io.anuke.arc.files.*;
import io.anuke.arc.graphics.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.game.*;
@ -25,6 +26,21 @@ public class MapPreviewLoader extends TextureLoader{
}
}
@Override
public Texture loadSync(AssetManager manager, String fileName, FileHandle file, TextureParameter parameter){
try{
return super.loadSync(manager, fileName, file, parameter);
}catch(Throwable e){
e.printStackTrace();
try{
return new Texture(file);
}catch(Throwable e2){
e2.printStackTrace();
return new Texture("sprites/error.png");
}
}
}
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, TextureParameter parameter){
return Array.with(new AssetDescriptor<>("contentcreate", Content.class));