From 2689c55fe2e014e75205e639ea192a90a6aa8bd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= <mic.grosse@googlemail.com>
Date: Sun, 27 Aug 2017 19:28:14 +0200
Subject: [PATCH] fix: access first element of associative arrays

This function might be called by an plugin with an array that has only
string keys and hence no key 0. This would trigger an PHP Notice when
trying to get the first key's level.
---
 inc/html.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/inc/html.php b/inc/html.php
index e7bc072e6..120d72b1f 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -1046,7 +1046,8 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default',$forcewrapp
         return '';
     }
 
-    $start_level = $data[0]['level'];
+    $firstElement = reset($data);
+    $start_level = $firstElement['level'];
     $level = $start_level;
     $ret   = '';
     $open  = 0;
-- 
GitLab