return null when asset cannot be read

This commit is contained in:
Hannes Janetzek 2013-09-11 13:53:30 +02:00
parent 6f2f74089b
commit d05c4ad0d1

View File

@ -6,8 +6,9 @@ import org.oscim.backend.AssetAdapter;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.GdxRuntimeException;
public class GdxAssetAdapter extends AssetAdapter{ public class GdxAssetAdapter extends AssetAdapter {
@Override @Override
public InputStream openFileAsStream(String fileName) { public InputStream openFileAsStream(String fileName) {
@ -15,6 +16,10 @@ public class GdxAssetAdapter extends AssetAdapter{
if (file == null) if (file == null)
throw new IllegalArgumentException("missing file " + fileName); throw new IllegalArgumentException("missing file " + fileName);
try {
return file.read(); return file.read();
} catch (GdxRuntimeException e) {
return null;
}
} }
} }