From b62564e3a91fc8b5412821ddf577c9be3a14ef07 Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Mon, 30 Jan 2017 13:47:03 -0500 Subject: [PATCH] Protect disposables from ClassCastException. --- core/src/processing/opengl/PGraphicsOpenGL.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 368be4a50..061c0377a 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -890,6 +890,9 @@ public class PGraphicsOpenGL extends PGraphics { @Override public boolean equals(Object obj) { + if (!(obj instanceof GLResourceTexture)) { + return false; + } GLResourceTexture other = (GLResourceTexture)obj; return other.glName == glName && other.context == context; @@ -936,6 +939,9 @@ public class PGraphicsOpenGL extends PGraphics { @Override public boolean equals(Object obj) { + if (!(obj instanceof GLResourceVertexBuffer)) { + return false; + } GLResourceVertexBuffer other = (GLResourceVertexBuffer)obj; return other.glId == glId && other.context == context; @@ -995,6 +1001,9 @@ public class PGraphicsOpenGL extends PGraphics { @Override public boolean equals(Object obj) { + if (!(obj instanceof GLResourceShader)) { + return false; + } GLResourceShader other = (GLResourceShader)obj; return other.glProgram == glProgram && other.glVertex == glVertex && @@ -1095,6 +1104,9 @@ public class PGraphicsOpenGL extends PGraphics { @Override public boolean equals(Object obj) { + if (!(obj instanceof GLResourceFrameBuffer)) { + return false; + } GLResourceFrameBuffer other = (GLResourceFrameBuffer)obj; return other.glFbo == glFbo && other.glDepth == glDepth &&