Check if VFileOpen is actually passed a path before trying to open it

This commit is contained in:
Jeffrey Pfau 2014-10-19 21:13:32 -07:00
parent ba5c77523d
commit d44bf73a81
1 changed files with 3 additions and 0 deletions

View File

@ -39,6 +39,9 @@ static struct VFile* _vdOpenFile(struct VDir* vd, const char* path, int mode);
static const char* _vdeName(struct VDirEntry* vde);
struct VFile* VFileOpen(const char* path, int flags) {
if (!path) {
return 0;
}
int fd = open(path, flags, 0666);
return VFileFromFD(fd);
}