Browse Source

Check if the sounds directory exists

markjcrane 2 years ago
parent
commit
9a1af50ba2
1 changed files with 5 additions and 3 deletions
  1. 5 3
      resources/classes/file.php

+ 5 - 3
resources/classes/file.php

@@ -66,9 +66,11 @@ class file {
 		if (!isset($voice)) { $voice = 'callie'; }
 		if (!isset($voice)) { $voice = 'callie'; }
 
 
 		//set the variables
 		//set the variables
-		$dir = $_SESSION['switch']['sounds']['dir'].'/'.$language.'/'.$dialect.'/'.$voice;
-		$rate = '8000';
-		$files = $this->glob($dir.'/*/'.$rate, true);
+		if (!empty($_SESSION['switch']['sounds']['dir']) && file_exists($_SESSION['switch']['sounds']['dir'])) {
+			$dir = $_SESSION['switch']['sounds']['dir'].'/'.$language.'/'.$dialect.'/'.$voice;
+			$rate = '8000';
+			$files = $this->glob($dir.'/*/'.$rate, true);
+		}
 
 
 		//loop through the languages
 		//loop through the languages
 		if (!empty($files)) {
 		if (!empty($files)) {