From e539f5ab8531a901c33004328ee4b59aa630d514 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 27 Feb 2006 22:14:40 +0000 Subject: [PATCH] Hah, standard stdio code crashed on the test case. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401459 --- src/file/SDL_rwops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)