Browse Source

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 years ago
parent
commit
b05a0c7c83
1 changed files with 7 additions and 1 deletions
  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;