Skip to content

Commit

Permalink
guard destroy_pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Apr 7, 2024
1 parent 056f592 commit e5e7f10
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,21 @@ class Layer_final : public Layer
#if NCNN_VULKAN
if (layer_vulkan)
{
return layer_vulkan->destroy_pipeline(opt);
int ret = 0;
if (vkdev)
{
ret = layer_vulkan->destroy_pipeline(opt);
}

if (!support_vulkan || !vkdev)
{
// fallback to cpu layer
delete layer_vulkan;
layer_vulkan = 0;
}

if (ret)
return ret;
}
#endif // NCNN_VULKAN

Expand Down

0 comments on commit e5e7f10

Please sign in to comment.