return null when asset cannot be read
This commit is contained in:
parent
6f2f74089b
commit
d05c4ad0d1
@ -6,8 +6,9 @@ import org.oscim.backend.AssetAdapter;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
|
||||
public class GdxAssetAdapter extends AssetAdapter{
|
||||
public class GdxAssetAdapter extends AssetAdapter {
|
||||
|
||||
@Override
|
||||
public InputStream openFileAsStream(String fileName) {
|
||||
@ -15,6 +16,10 @@ public class GdxAssetAdapter extends AssetAdapter{
|
||||
if (file == null)
|
||||
throw new IllegalArgumentException("missing file " + fileName);
|
||||
|
||||
try {
|
||||
return file.read();
|
||||
} catch (GdxRuntimeException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user