From 05586ce4a24dcbcb6b275850c9ccc3060b8f4f3e Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Sun, 14 Jan 2018 10:38:05 +0100 Subject: [PATCH] Don't destroy null-objects in UniqueHandle (Fixes #171). --- VulkanHppGenerator.cpp | 4 ++-- vulkan/vulkan.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index cbd0beb..ce5d407 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -594,7 +594,7 @@ const std::string uniqueHandleHeader = R"( ~UniqueHandle() { - this->destroy( m_value ); + if ( m_value ) this->destroy( m_value ); } UniqueHandle & operator=( UniqueHandle const& ) = delete; @@ -645,7 +645,7 @@ const std::string uniqueHandleHeader = R"( { if ( m_value != value ) { - this->destroy( m_value ); + if ( m_value ) this->destroy( m_value ); m_value = value; } } diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 9b5a048..55ca8e0 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -351,7 +351,7 @@ namespace VULKAN_HPP_NAMESPACE ~UniqueHandle() { - this->destroy( m_value ); + if ( m_value ) this->destroy( m_value ); } UniqueHandle & operator=( UniqueHandle const& ) = delete; @@ -402,7 +402,7 @@ namespace VULKAN_HPP_NAMESPACE { if ( m_value != value ) { - this->destroy( m_value ); + if ( m_value ) this->destroy( m_value ); m_value = value; } }