From 382c6d71865f0207ab8f81db5a1e4e1317aa6622 Mon Sep 17 00:00:00 2001 From: xqcool <32193768+xqcool@users.noreply.github.com> Date: Wed, 1 Jan 2020 17:37:51 +0800 Subject: [PATCH] Update array.hpp (#3769) * Update array.hpp Problem:Calling back on an empty container causes undefined behavior. Solution:Check with the function empty() * Create xqcool.mq Adds relicensing grant --- RELICENSE/xqcool.mq | 15 +++++++++++++++ src/array.hpp | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 RELICENSE/xqcool.mq diff --git a/RELICENSE/xqcool.mq b/RELICENSE/xqcool.mq new file mode 100644 index 00000000..eb7786d3 --- /dev/null +++ b/RELICENSE/xqcool.mq @@ -0,0 +1,15 @@ +# Permission to Relicense under MPLv2 or any other share-alike OSI approved license chosen by the current ZeroMQ BDFL + +This is a statement by xqcool +that grants permission to relicense its copyrights in the libzmq C++ +library (ZeroMQ) under the Mozilla Public License v2 (MPLv2) or any other +share-alike Open Source Initiative approved license chosen by the current +ZeroMQ BDFL (Benevolent Dictator for Life). + +A portion of the commits made by the Github handle "xqcool", with +commit author "xqcool <xuquan316@live.com>", are copyright of xqcool . +This document hereby grants the libzmq project team to relicense libzmq, +including all past, present and future contributions of the author listed above. + +xqcool +2020/01/01 diff --git a/src/array.hpp b/src/array.hpp index a5cd433c..b141a082 100644 --- a/src/array.hpp +++ b/src/array.hpp @@ -100,8 +100,9 @@ template <typename T, int ID = 0> class array_t inline void erase (size_type index_) { - if (_items.back ()) - ((item_t *) _items.back ())->set_array_index ((int) index_); + if (_items.empty ()) + return; + ((item_t *) _items.back ())->set_array_index ((int) index_); _items[index_] = _items.back (); _items.pop_back (); }