Never show an empty table of contents

This doesn't seem to have got updated when we revised the data format
in T299065.

Bug: T303860
Change-Id: Ib955950e014668fe434da4a1654e977eb43f7dd8
This commit is contained in:
Jon Robson 2022-03-17 12:03:48 -07:00 committed by Jdlrobson
parent 2e48d378f0
commit f3f777818c

View file

@ -682,7 +682,9 @@ class SkinVector extends SkinMustache {
* @return array
*/
private function getTocData( array $tocData ): array {
if ( empty( $tocData ) ) {
// If the table of contents has no items, we won't output it.
// empty array is interpreted by Mustache as falsey.
if ( empty( $tocData ) || empty( $tocData[ 'array-sections' ] ) ) {
return [];
}