Fixed an issue with how reading text files with bufferedReader was done. Using a null check for EOF instead of buffer.ready(). This was causing a NPE on android 4.4

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10923 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
rem..om 11 years ago
parent 45e82cdbb1
commit 9d63a7fc02
  1. 7
      engine/src/core-plugins/com/jme3/font/plugins/BitmapFontLoader.java
  2. 4
      engine/src/core-plugins/com/jme3/shader/plugins/GLSLLoader.java

@ -43,23 +43,22 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
public class BitmapFontLoader implements AssetLoader {
private BitmapFont load(AssetManager assetManager, String folder, InputStream in) throws IOException{
MaterialDef spriteMat =
(MaterialDef) assetManager.loadAsset(new AssetKey("Common/MatDefs/Misc/Unshaded.j3md"));
BitmapCharacterSet charSet = new BitmapCharacterSet();
Material[] matPages = null;
BitmapFont font = new BitmapFont();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String regex = "[\\s=]+";
font.setCharSet(charSet);
while (reader.ready()){
String line = reader.readLine();
String line;
while ((line = reader.readLine())!=null){
String[] tokens = line.split(regex);
if (tokens[0].equals("info")){
// Get rendered size

@ -82,8 +82,8 @@ public class GLSLLoader implements AssetLoader {
StringBuilder sb = new StringBuilder();
BufferedReader bufReader = new BufferedReader(reader);
try {
while (bufReader.ready()) {
String ln = bufReader.readLine();
String ln;
while ((ln = bufReader.readLine()) != null) {
if (ln.trim().startsWith("#import ")) {
ln = ln.trim().substring(8).trim();
if (ln.startsWith("\"") && ln.endsWith("\"") && ln.length() > 3) {

Loading…
Cancel
Save