1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

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.
This commit is contained in:
Michał W. Urbańczyk
2011-08-08 06:28:18 +00:00
parent c1ffe738f0
commit b05a0c7c83

View File

@@ -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;