Don't crash reversing empty Vectors
In a new, empty vector start and end are null.
Esse commit está contido em:
@@ -405,6 +405,7 @@ void c_Vector::t_sort(CVarRef col /* = null */) {
|
||||
}
|
||||
|
||||
void c_Vector::t_reverse() {
|
||||
if (m_size <= 1) return;
|
||||
TypedValue* start = m_data;
|
||||
TypedValue* end = m_data + m_size - 1;
|
||||
for (; start < end; ++start, --end) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
function test() {
|
||||
$v = new Vector;
|
||||
$v->reverse();
|
||||
var_dump($v);
|
||||
}
|
||||
|
||||
test();
|
||||
@@ -0,0 +1,2 @@
|
||||
object(Vector)#1 (0) {
|
||||
}
|
||||
Referência em uma Nova Issue
Bloquear um usuário