Skip to content

Commit a86a6eb

Browse files
stephengoldAli-RS
authored andcommitted
solve issue #1969: missing check in GLRenderer.clearVertexAttribs() (#1970)
1 parent ec68c6a commit a86a6eb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2023 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -2922,13 +2922,16 @@ public void clearVertexAttribs() {
29222922
for (int i = 0; i < attribList.oldLen; i++) {
29232923
int idx = attribList.oldList[i];
29242924
gl.glDisableVertexAttribArray(idx);
2925-
VertexBuffer buffer = context.boundAttribs[idx].get();
2926-
if (buffer != null && buffer.isInstanced()) {
2927-
glext.glVertexAttribDivisorARB(idx, 0);
2925+
WeakReference<VertexBuffer> ref = context.boundAttribs[idx];
2926+
if (ref != null) {
2927+
VertexBuffer buffer = ref.get();
2928+
if (buffer != null && buffer.isInstanced()) {
2929+
glext.glVertexAttribDivisorARB(idx, 0);
2930+
}
2931+
context.boundAttribs[idx] = null;
29282932
}
2929-
context.boundAttribs[idx] = null;
29302933
}
2931-
context.attribIndexList.copyNewToOld();
2934+
attribList.copyNewToOld();
29322935
}
29332936

29342937
public void setVertexAttrib(VertexBuffer vb, VertexBuffer idb) {

0 commit comments

Comments
 (0)