diff --git a/src/modm/utils/allocator.hpp b/src/modm/utils/allocator.hpp index 880220a3e4..28f600414d 100644 --- a/src/modm/utils/allocator.hpp +++ b/src/modm/utils/allocator.hpp @@ -42,6 +42,7 @@ class AllocatorBase static inline void construct(T* p, const T& value) { + if (p == nullptr) return; // placement new ::new((void *) p) T(value); } @@ -57,6 +58,7 @@ class AllocatorBase static inline void destroy(T* p) { + if (p == nullptr) return; p->~T(); }