diff options
author | Michael Hamann <michael@content-space.de> | 2011-04-26 23:40:24 +0200 |
---|---|---|
committer | Michael Hamann <michael@content-space.de> | 2011-04-26 23:40:24 +0200 |
commit | 65f40513c558b4d57493485465b12d493911f2a5 (patch) | |
tree | fb626dc4950d986e9bbb6cedbc7677696e2551d9 | |
parent | c66f16a3e1edb46da1d29b306c718b775439f5d5 (diff) | |
download | rpg-65f40513c558b4d57493485465b12d493911f2a5.tar.gz rpg-65f40513c558b4d57493485465b12d493911f2a5.tar.bz2 |
Fix p_get_first_heading for when the search index is empty
When the search index is empty, there was a warning and no headings were
displayed. Now the headings are displayed and there is no warning
anymore.
-rw-r--r-- | inc/parserutils.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/inc/parserutils.php b/inc/parserutils.php index 9b2d99328..84aaebb4e 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -682,10 +682,15 @@ function p_get_first_heading($id, $render=true){ if(count($pages) != count($titles)){ $titles = array_fill(0,count($pages),''); @unlink($conf['indexdir'].'/title.idx'); // will be rebuilt in inc/init.php + } else { + if (!empty($pages)) // array_combine throws a warning when the parameters are empty arrays + $title_index = array_combine($pages, $titles); + else + $title_index = array(); } - $title_index = array_combine($pages, $titles); } - return $title_index[$id]; + if (!empty($title_index)) // don't use the index when it obviously isn't working + return $title_index[$id]; } ++$count; |