Browse Source

fix(list): check if ptr is null before releasing

greatbridf 2 years ago
parent
commit
975ac4c437
1 changed files with 2 additions and 0 deletions
  1. 2 0
      include/types/list.hpp

+ 2 - 0
include/types/list.hpp

@@ -165,6 +165,8 @@ private:
 
 
     void destroy(void)
     void destroy(void)
     {
     {
+        if (!head || !tail)
+            return;
         clear();
         clear();
         allocator_traits<sentry_allocator_type>::deconstruct_and_deallocate(static_cast<sentry_node_type*>(head));
         allocator_traits<sentry_allocator_type>::deconstruct_and_deallocate(static_cast<sentry_node_type*>(head));
         allocator_traits<sentry_allocator_type>::deconstruct_and_deallocate(static_cast<sentry_node_type*>(tail));
         allocator_traits<sentry_allocator_type>::deconstruct_and_deallocate(static_cast<sentry_node_type*>(tail));