bullet-proofing - fail if reloading VDir
This was SVN commit r531.
This commit is contained in:
parent
3c6becec37
commit
941f7c3661
@ -887,12 +887,17 @@ static void VDir_dtor(VDir* vd)
|
|||||||
|
|
||||||
static int VDir_reload(VDir* vd, const char* path)
|
static int VDir_reload(VDir* vd, const char* path)
|
||||||
{
|
{
|
||||||
// check if actually reloaded, and why it happened?
|
if(vd->subdirs)
|
||||||
|
{
|
||||||
|
debug_warn("VDir_reload called when already loaded - why?");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
Dir* dir;
|
Dir* dir;
|
||||||
CHECK_ERR(tree_lookup(path, 0, &dir));
|
CHECK_ERR(tree_lookup(path, 0, &dir));
|
||||||
|
|
||||||
// rationale for copy: see VDir definition
|
// rationale for copying the dir's data: see VDir definition
|
||||||
|
// note: bad_alloc exception handled by h_alloc.
|
||||||
vd->subdirs = new SubDirs(dir->subdirs);
|
vd->subdirs = new SubDirs(dir->subdirs);
|
||||||
vd->subdir_it = vd->subdirs->begin();
|
vd->subdir_it = vd->subdirs->begin();
|
||||||
vd->files = new Files(dir->files);
|
vd->files = new Files(dir->files);
|
||||||
|
Loading…
Reference in New Issue
Block a user