check count before foreach

This commit is contained in:
friendica 2012-01-02 22:58:09 -08:00
parent 0db637bf00
commit 184230e068
1 changed files with 3 additions and 2 deletions

View File

@ -918,8 +918,9 @@ function conv_sort($arr,$order) {
$ret = array();
foreach($parents as $x) {
$ret[] = $x;
foreach($x['children'] as $y)
$ret[] = $y;
if(count($x['children']))
foreach($x['children'] as $y)
$ret[] = $y;
}
return $ret;