zippath.c: Fixed crash in debug builds. [somebody]

This commit is contained in:
Curt Coder 2013-10-18 19:41:59 +00:00
parent 4a5fbe75e6
commit c704f0cef4

View File

@ -614,13 +614,16 @@ file_error zippath_opendir(const char *path, zippath_directory **directory)
file_error err;
/* allocate a directory */
zippath_directory *result = new(std::nothrow) zippath_directory;
if (result == NULL)
zippath_directory *result = NULL;
try
{
result = new zippath_directory;
}
catch (std::bad_alloc &)
{
err = FILERR_OUT_OF_MEMORY;
goto done;
}
/* resolve the path */
osd_dir_entry_type entry_type;
err = zippath_resolve(path, entry_type, result->zipfile, result->zipprefix);