diff --git a/aegisub/libaegisub/include/libaegisub/util.h b/aegisub/libaegisub/include/libaegisub/util.h index f48a8a967..931313df0 100644 --- a/aegisub/libaegisub/include/libaegisub/util.h +++ b/aegisub/libaegisub/include/libaegisub/util.h @@ -74,8 +74,10 @@ namespace agi { }; template void delete_clear(T& container) { - std::for_each(container.begin(), container.end(), delete_ptr()); - container.clear(); + if (!container.empty()) { + std::for_each(container.begin(), container.end(), delete_ptr()); + container.clear(); + } } } // namespace util