aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_gl.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index d0f1a692..965feae6 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -636,6 +636,13 @@ var LibraryGL = {
for (var i = 0; i < n; i++) {
var id = {{{ makeGetValue('buffers', 'i*4', 'i32') }}};
var buffer = GL.buffers[id];
+
+ // From spec: "glDeleteBuffers silently ignores 0's and names that do not
+ // correspond to existing buffer objects."
+ if(buffer === null)
+ {
+ continue;
+ }
Module.ctx.deleteBuffer(buffer);
buffer.name = 0;
GL.buffers[id] = null;