瀏覽代碼

:bug: $FetParent 没有判断返回值

visuddhinanda 4 年之前
父節點
當前提交
4c7cc603b4
共有 1 個文件被更改,包括 14 次插入9 次删除
  1. 14 9
      app/search/paliword_search.php

+ 14 - 9
app/search/paliword_search.php

@@ -210,15 +210,20 @@ switch ($op) {
                         while ($parent > -1) {
                             $query = "SELECT * from "._TABLE_PALI_TEXT_." where book = ? and paragraph = ? limit 1";
                             $FetParent = PDO_FetchAll($query,array($book,$parent));
-                            $path = "{$FetParent[0]["toc"]}>{$path}";
-                            if ($sFirstParentTitle == "") {
-                                $sFirstParentTitle = $FetParent[0]["toc"];
-                            }
-                            $parent = $FetParent[0]["parent"];
-                            $deep++;
-                            if ($deep > 5) {
-                                break;
-                            }
+							if($FetParent){
+								$path = "{$FetParent[0]["toc"]}>{$path}";
+								if ($sFirstParentTitle == "") {
+									$sFirstParentTitle = $FetParent[0]["toc"];
+								}
+								$parent = $FetParent[0]["parent"];
+								$deep++;
+								if ($deep > 5) {
+									break;
+								}
+							}else{
+								break;
+							}
+
                         }
                         $path = $path_1 . $path . "para. " . $paragraph;
                         echo "<div class='mean' style='font-size:120%'><a href='../reader/?view=para&book={$book}&para={$paragraph}&display=para' target='_blank'>$path</a></div>";