changeset 1455:f487bb150acc

Hah, standard stdio code crashed on the test case.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 27 Feb 2006 22:14:40 +0000
parents 07d2b0085ecd
children 84de7511f79f
files src/file/SDL_rwops.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/file/SDL_rwops.c	Mon Feb 27 21:17:12 2006 +0000
+++ b/src/file/SDL_rwops.c	Mon Feb 27 22:14:40 2006 +0000
@@ -44,7 +44,7 @@
 	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 *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)