From 7ef81f909fc04e261a7c04d4822d79dd7fce6e65 Mon Sep 17 00:00:00 2001 From: Pascal Deklerck Date: Wed, 13 Jun 2018 21:57:59 +0200 Subject: [PATCH] Defensive code for the case when addon_hooks key does not exist --- mathjax/mathjax.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index 6f4dd395..91a6a066 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -27,7 +27,12 @@ function mathjax_uninstall() { Addon::unregisterHook('template_vars', 'addon/mathjax/mathjax.php', 'mathjax_template_vars'); } -function mathjax_template_vars($a, &$arr) { +function mathjax_template_vars($a, &$arr) +{ + if (!array_key_exists('addon_hooks',$arr['vars'])) + { + $arr['vars']['addon_hooks'] = array(); + } $arr['vars']['addon_hooks'][] = "mathjax"; } -- 2.39.5