mirror of https://github.com/godotengine/godot
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();
|
Element *I = front();
|
||||||
int c = 0;
|
int c = 0;
|
||||||
while (I) {
|
while (c < p_index) {
|
||||||
|
|
||||||
if (c == p_index) {
|
|
||||||
|
|
||||||
return I->get();
|
|
||||||
}
|
|
||||||
I = I->next();
|
I = I->next();
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CRASH_NOW(); // bug!!
|
return I->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const T &operator[](int p_index) const {
|
const T &operator[](int p_index) const {
|
||||||
|
|
@ -475,17 +470,12 @@ public:
|
||||||
|
|
||||||
const Element *I = front();
|
const Element *I = front();
|
||||||
int c = 0;
|
int c = 0;
|
||||||
while (I) {
|
while (c < p_index) {
|
||||||
|
|
||||||
if (c == p_index) {
|
|
||||||
|
|
||||||
return I->get();
|
|
||||||
}
|
|
||||||
I = I->next();
|
I = I->next();
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CRASH_NOW(); // bug!!
|
return I->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_to_back(Element *p_I) {
|
void move_to_back(Element *p_I) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue