diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c
index 13e0d70a4c6cae3bccbd7e935e8836850128ddac..e025272db0334df4bb23fb5b53b7dc596a853114 100644
--- a/src/xpdev/dirwrap.c
+++ b/src/xpdev/dirwrap.c
@@ -316,7 +316,8 @@ long DLLCALL getdirsize(const char* path, BOOL include_subdirs, BOOL subdir_only
 	SAFECOPY(match,path);
 	backslash(match);
 	SAFECAT(match,ALLFILES);
-	glob(match,GLOB_MARK,NULL,&g);
+	if (glob(match,GLOB_MARK,NULL,&g) != 0)
+		return 0;
 	if(include_subdirs && !subdir_only)
 		count=g.gl_pathc;
 	else