Skip to content

Commit 5c62b94

Browse files
committed
fix textureloader crash
1 parent 197f670 commit 5c62b94

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

encoder/src/main/java/com/pedro/encoder/input/gl/TextureLoader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public int[] load(Bitmap[] bitmaps) {
3636
int[] textureId = new int[bitmaps.length];
3737
GlUtil.createTextures(bitmaps.length, textureId, 0);
3838
for (int i = 0; i < bitmaps.length; i++) {
39-
if (bitmaps[i] != null) {
39+
if (bitmaps[i] != null && !bitmaps[i].isRecycled()) {
4040
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId[i]);
4141
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmaps[i], 0);
42-
if (!bitmaps[i].isRecycled()) bitmaps[i].recycle();
43-
bitmaps[i] = null;
42+
bitmaps[i].recycle();
4443
}
44+
bitmaps[i] = null;
4545
}
4646
return textureId;
4747
}

0 commit comments

Comments
 (0)