Przeglądaj źródła

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

visuddhinanda 4 lat temu
rodzic
commit
4c7cc603b4
1 zmienionych plików z 14 dodań i 9 usunięć
  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>";