mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #3813
3813: Only sort friends, if you got any r=def- a=Jupeyy as TsFreddie pointed out, it asserts inside the array function back(), bcs the list is empty. ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Jupeyy <jupjopjap@gmail.com> Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
70f79bf3bc
|
@ -2203,6 +2203,7 @@ if(GTEST_FOUND OR DOWNLOAD_GTEST)
|
|||
netaddr.cpp
|
||||
packer.cpp
|
||||
prng.cpp
|
||||
sorted_array.cpp
|
||||
str.cpp
|
||||
strip_path_and_extension.cpp
|
||||
teehistorian.cpp
|
||||
|
|
|
@ -38,7 +38,8 @@ public:
|
|||
|
||||
void sort_range()
|
||||
{
|
||||
sort(all());
|
||||
if(parent::size() > 0)
|
||||
sort(all());
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
9
src/test/sorted_array.cpp
Normal file
9
src/test/sorted_array.cpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include <base/tl/sorted_array.h>
|
||||
|
||||
TEST(SortedArray, SortEmptyRange)
|
||||
{
|
||||
sorted_array<int> x;
|
||||
x.sort_range();
|
||||
}
|
Loading…
Reference in a new issue