Skip to content

Commit

Permalink
fix: empty reply tree leads to non-array return value (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricerenck authored Feb 7, 2021
1 parent e9c5eed commit 9cdd0e6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mauricerenck/komments",
"version": "0.10.1",
"version": "0.10.2",
"description": "A comment and webmention plugin for Kirby 3",
"type": "kirby-plugin",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "komments",
"version": "0.10.1",
"version": "0.10.2",
"description": "A comment and webmention plugin for Kirby 3",
"main": "index.js",
"author": "Maurice Renck",
Expand Down
8 changes: 5 additions & 3 deletions snippets/webmentions-splitted.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ function addReply($komment)
}
}

foreach ($komments['replies'] as $komment) {
if ($page->hasQueuedKomments($komment['komment']->id(), $komment['komment']->status())) {
$kommentsInModeration++;
if (count($komments['replies']) > 0) {
foreach ($komments['replies'] as $komment) {
if ($page->hasQueuedKomments($komment['komment']->id(), $komment['komment']->status())) {
$kommentsInModeration++;
}
}
}
?>
Expand Down
2 changes: 2 additions & 0 deletions utils/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public function parseKomments($komments)

public function buildTree($flatArray)
{
$tree = [];

foreach ($flatArray as $key => $flat) {
$nodes = [];
$tree = [];
Expand Down

0 comments on commit 9cdd0e6

Please sign in to comment.