found a small problem in latest version of Beyondar

Forums:

I was using an older version of beyondar framework with an app, That older version of Beyondar had no problems and ran perfect.  However.... today I  downloaded the most recent version of the framework and was getting crashes.  I was using an ASUS tabet and Eclipse on a Lenovo notebook running Windows 7, then I went home and changed to a Nexus 7 tablet and Eclispe on a Macbook Pro.  I got the same crash and stack trace on both configurations. Then fixed it.  shown below.  The null pointer exception came from ARRenderer class.

<<<<< CODE WITH FIX >>>>>>>>>>>

private void loadWorldTextures(GL10 gl) {

if (null != mWorld) {  <-- EXTENDING THIS IF CHECK SCOPE LOWER WOULD FIX IT ALSO

try {

BeyondarObjectList list = null;

for (int i = 0; i < mWorld.getBeyondarObjectLists().size(); i++) {

list = mWorld.getBeyondarObjectLists().get(i);

if (null != list) {

Bitmap defaultBtm = mWorld.getBitmapCache().getBitmap(list.getDefaultImageUri());

Texture texture = load2DTexture(gl, defaultBtm);

list.setDefaultTexture(texture);

 

for (int j = 0; j < list.size(); j++) {

// loading texture

loadBeyondarObjectTexture(gl, list.get(j));

}

}

}

} catch (ConcurrentModificationException e) {

loadWorldTextures(gl);

}

}

if(null != mWorld) { // <-- FIXED BY ADDING THIS NULL CHECK

mWorld.getBitmapCache().cleanRecylcedBitmaps();  // <-- NULL POINTER CRASH THIS LINE

}

}

<<<<<<<< STACK TRACE FROM ECLIPSE >>>>>>>>>>>>>>>>>

04-15 21:46:12.941: E/GmsClient(20737): Calling connect() while still connected, missing disconnect().

04-15 21:46:15.473: E/GmsClient(20737): Calling connect() while still connected, missing disconnect().

04-15 21:46:21.389: E/GmsClient(20737): Calling connect() while still connected, missing disconnect().

04-15 21:48:16.531: E/GmsClient(25373): Calling connect() while still connected, missing disconnect().

04-15 21:48:17.182: E/AndroidRuntime(25373): FATAL EXCEPTION: GLThread 3204

04-15 21:48:17.182: E/AndroidRuntime(25373): Process: com.xxx.xxx, PID: 25373

04-15 21:48:17.182: E/AndroidRuntime(25373): java.lang.NullPointerException

04-15 21:48:17.182: E/AndroidRuntime(25373): at com.beyondar.android.opengl.renderer.ARRenderer.loadWorldTextures(ARRenderer.java:855)

04-15 21:48:17.182: E/AndroidRuntime(25373): at com.beyondar.android.opengl.renderer.ARRenderer.onSurfaceCreated(ARRenderer.java:805)

04-15 21:48:17.182: E/AndroidRuntime(25373): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1501)

04-15 21:48:17.182: E/AndroidRuntime(25373): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

 

Beyondar's picture

Nice one :)

I just commit the changes here, can you tell me if it is ok?

Next time try to report this things here, eventually I'll close the forum and I'll redirect all the questions to the gitHub page