fextl: Properly handle nullptr arguments in fextl::default_delete

This reflects behavior of std::default_delete.
This commit is contained in:
Tony Wasserka 2024-07-10 19:16:40 +02:00
parent 72d6c8ebd6
commit 470b435afd

View File

@ -9,8 +9,10 @@ namespace fextl {
template<class T>
struct default_delete : public std::default_delete<T> {
void operator()(T* ptr) const {
std::destroy_at(ptr);
FEXCore::Allocator::aligned_free(ptr);
if (ptr) {
std::destroy_at(ptr);
FEXCore::Allocator::aligned_free(ptr);
}
}
template<typename U>