mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 21:52:51 +00:00
Refactor List operator[] to prevent compiler warnings.
Prevents GCC compiler throwing: control reaches end of non-void function. Prevents Visual Studio throwing C4715: not all control paths return a value.
This commit is contained in:
parent
6fb6405408
commit
07d21b84a3
18
core/list.h
18
core/list.h
@ -456,17 +456,12 @@ public:
|
||||
|
||||
Element *I = front();
|
||||
int c = 0;
|
||||
while (I) {
|
||||
|
||||
if (c == p_index) {
|
||||
|
||||
return I->get();
|
||||
}
|
||||
while (c < p_index) {
|
||||
I = I->next();
|
||||
c++;
|
||||
}
|
||||
|
||||
CRASH_NOW(); // bug!!
|
||||
return I->get();
|
||||
}
|
||||
|
||||
const T &operator[](int p_index) const {
|
||||
@ -475,17 +470,12 @@ public:
|
||||
|
||||
const Element *I = front();
|
||||
int c = 0;
|
||||
while (I) {
|
||||
|
||||
if (c == p_index) {
|
||||
|
||||
return I->get();
|
||||
}
|
||||
while (c < p_index) {
|
||||
I = I->next();
|
||||
c++;
|
||||
}
|
||||
|
||||
CRASH_NOW(); // bug!!
|
||||
return I->get();
|
||||
}
|
||||
|
||||
void move_to_back(Element *p_I) {
|
||||
|
Loading…
Reference in New Issue
Block a user