summaryrefslogtreecommitdiff
path: root/drivers/gles2/rasterizer_storage_gles2.cpp
diff options
context:
space:
mode:
authorRafał Mikrut <mikrutrafal54@gmail.com>2019-10-28 08:07:29 +0100
committerRafał Mikrut <mikrutrafal54@gmail.com>2019-10-28 08:07:29 +0100
commite53e1c566ac9e2e9b829f1cdbfd5d27537053cd1 (patch)
tree76cbb7b71e5da369511c6803926e33cbec858715 /drivers/gles2/rasterizer_storage_gles2.cpp
parent4ecc30cc5ed04c770efd79c2c9f2b1dc9ae0af39 (diff)
Fix some crashes and using null pointers
Diffstat (limited to 'drivers/gles2/rasterizer_storage_gles2.cpp')
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 451d6adaa9..4a7d91b18a 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -665,6 +665,7 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
texture->data_size = img->get_data().size();
PoolVector<uint8_t>::Read read = img->get_data().read();
+ ERR_FAIL_COND(!read.ptr());
glActiveTexture(GL_TEXTURE0);
glBindTexture(texture->target, texture->tex_id);
@@ -3236,12 +3237,14 @@ Color RasterizerStorageGLES2::multimesh_instance_get_custom_data(RID p_multimesh
void RasterizerStorageGLES2::multimesh_set_as_bulk_array(RID p_multimesh, const PoolVector<float> &p_array) {
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND(!multimesh);
+ ERR_FAIL_COND(!multimesh->data.ptr());
int dsize = multimesh->data.size();
ERR_FAIL_COND(dsize != p_array.size());
PoolVector<float>::Read r = p_array.read();
+ ERR_FAIL_COND(!r.ptr());
copymem(multimesh->data.ptrw(), r.ptr(), dsize * sizeof(float));
multimesh->dirty_data = true;