summaryrefslogtreecommitdiffstats
path: root/windows.c
diff options
context:
space:
mode:
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/windows.c b/windows.c
index 9288af45f..7c537f6e5 100644
--- a/windows.c
+++ b/windows.c
@@ -114,6 +114,8 @@ static wchar_t *utf8_to_utf16_fl(const char *utf8, char *file, int line)
int subsurface_open(const char *path, int oflags, mode_t mode)
{
int ret = -1;
+ if (!path)
+ return -1;
wchar_t *wpath = utf8_to_utf16(path);
if (wpath) {
ret = _wopen(wpath, oflags, mode);
@@ -126,6 +128,8 @@ int subsurface_open(const char *path, int oflags, mode_t mode)
FILE *subsurface_fopen(const char *path, const char *mode)
{
FILE *ret = NULL;
+ if (!path)
+ return ret;
wchar_t *wpath = utf8_to_utf16(path);
if (wpath) {
const int len = strlen(mode);
@@ -144,6 +148,8 @@ FILE *subsurface_fopen(const char *path, const char *mode)
void *subsurface_opendir(const char *path)
{
_WDIR *ret = NULL;
+ if (!path)
+ return ret;
wchar_t *wpath = utf8_to_utf16(path);
if (wpath) {
ret = _wopendir(wpath);