Pārlūkot izejas kodu

The add_file method throws an exception where there is no file with a given name.
Catch it and leave NULL, so the silent return can be used.

Michał W. Urbańczyk 14 gadi atpakaļ
vecāks
revīzija
b05a0c7c83
1 mainītis faili ar 7 papildinājumiem un 1 dzēšanām
  1. 7 1
      client/CSndHandler.cpp

+ 7 - 1
client/CSndHandler.cpp

@@ -136,7 +136,13 @@ const char * CMediaHandler::extract (std::string srcName, int &size)
 
 void CSndHandler::add_file(std::string fname)
 {
-	boost::iostreams::mapped_file_source *mfile = CMediaHandler::add_file(fname);
+	boost::iostreams::mapped_file_source *mfile = NULL;
+	try
+	{
+		mfile = CMediaHandler::add_file(fname);
+	}
+	catch(...)
+	{}
 	if (!mfile)
 		/* File doesn't exist. Silently skip it.*/
 		return;