diff options
author | Eugene Sandulenko | 2016-05-23 16:08:17 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-23 16:36:34 +0200 |
commit | 3d89af272b718dd30a60f351149fde95958acfb0 (patch) | |
tree | 321cfb3f2282124a21a59f7c60a67497f9a78a89 | |
parent | 1f8667c5d949070035390531e4f10c0f945d7352 (diff) | |
download | scummvm-rg350-3d89af272b718dd30a60f351149fde95958acfb0.tar.gz scummvm-rg350-3d89af272b718dd30a60f351149fde95958acfb0.tar.bz2 scummvm-rg350-3d89af272b718dd30a60f351149fde95958acfb0.zip |
COMMON: Fix SortedArray implementation for empty array
-rw-r--r-- | common/array.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/array.h b/common/array.h index 869d79b68b..29a1ff8470 100644 --- a/common/array.h +++ b/common/array.h @@ -378,6 +378,11 @@ public: * Inserts element at the sorted position. */ void insert(const T &element) { + if (!this->_size) { + this->insert_aux(this->_storage, &element, &element + 1); + return; + } + T *where = (T *)bsearchMin(element, this->front(), this->_size, sizeof(T), _comparator); insert(where, element); } |