diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index f11660fe8..4e284b24e 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -44,7 +44,7 @@ static int win32_file_open(SDL_RWops *context, const char *filename, const char DWORD must_exist, truncate; int a_mode; - if (!context || !filename || !mode) + if (!context) return -1; context->hidden.win32io.h = INVALID_HANDLE_VALUE; /* mark this as unusable */ @@ -336,6 +336,11 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode) { SDL_RWops *rwops = NULL; + if ( !file || !*file || !mode || !*mode ) { + SDL_SetError("SDL_RWFromFile(): No file or no mode specified"); + return NULL; + } + #ifdef __WIN32__ rwops = SDL_AllocRW(); if (!rwops)