fix null reference

pull/8/head
cosmonaut 2020-12-27 15:38:58 -08:00
parent 2a4811315b
commit 39ec13501a
1 changed files with 6 additions and 6 deletions

View File

@ -5022,13 +5022,13 @@ static void VULKAN_SetVertexSamplers(
VulkanGraphicsPipeline *graphicsPipeline = (VulkanGraphicsPipeline*) pipeline; VulkanGraphicsPipeline *graphicsPipeline = (VulkanGraphicsPipeline*) pipeline;
SamplerDescriptorSetData vertexSamplerDescriptorSetData; SamplerDescriptorSetData vertexSamplerDescriptorSetData;
samplerCount = graphicsPipeline->pipelineLayout->vertexSamplerDescriptorSetCache->samplerBindingCount; if (graphicsPipeline->pipelineLayout->vertexSamplerDescriptorSetCache == NULL)
if (samplerCount == 0)
{ {
return; return;
} }
samplerCount = graphicsPipeline->pipelineLayout->vertexSamplerDescriptorSetCache->samplerBindingCount;
for (i = 0; i < samplerCount; i += 1) for (i = 0; i < samplerCount; i += 1)
{ {
currentTexture = (VulkanTexture*) pTextures[i]; currentTexture = (VulkanTexture*) pTextures[i];
@ -5057,13 +5057,13 @@ static void VULKAN_SetFragmentSamplers(
VulkanGraphicsPipeline *graphicsPipeline = (VulkanGraphicsPipeline*) pipeline; VulkanGraphicsPipeline *graphicsPipeline = (VulkanGraphicsPipeline*) pipeline;
SamplerDescriptorSetData fragmentSamplerDescriptorSetData; SamplerDescriptorSetData fragmentSamplerDescriptorSetData;
samplerCount = graphicsPipeline->pipelineLayout->fragmentSamplerDescriptorSetCache->samplerBindingCount; if (graphicsPipeline->pipelineLayout->vertexSamplerDescriptorSetCache == NULL)
if (samplerCount == 0)
{ {
return; return;
} }
samplerCount = graphicsPipeline->pipelineLayout->fragmentSamplerDescriptorSetCache->samplerBindingCount;
for (i = 0; i < samplerCount; i += 1) for (i = 0; i < samplerCount; i += 1)
{ {
currentTexture = (VulkanTexture*) pTextures[i]; currentTexture = (VulkanTexture*) pTextures[i];