diff src/video/windib/SDL_dibevents.c @ 421:195dd37b3d86

Bugfix from Corona688: don't reference a string before we've initialized it. Fixes crashbug on WinCE (PocketPC).
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 02 Jul 2002 04:07:01 +0000
parents 13fc64213765
children a6fa62b1be09
line wrap: on
line diff
--- a/src/video/windib/SDL_dibevents.c	Thu Jun 20 17:47:42 2002 +0000
+++ b/src/video/windib/SDL_dibevents.c	Tue Jul 02 04:07:01 2002 +0000
@@ -335,11 +335,18 @@
 {
 #ifdef _WIN32_WCE
 	/* WinCE uses the UNICODE version */
-	int nLen = strlen(SDL_Appname)+1;
-	LPWSTR lpszW = alloca(nLen*2);
-	MultiByteToWideChar(CP_ACP, 0, SDL_Appname, -1, lpszW, nLen);
+	int nLen;
+	LPWSTR lpszW;
 
-	SDL_RegisterApp("SDL_app", 0, 0);
+	if ( SDL_RegisterApp("SDL_app", 0, 0) != 0 ) {
+		return -1;
+	}
+
+	nLen = strlen(SDL_Appname) + 1;
+	lpszW = alloca(nLen * 2);
+
+	MultiByteToWideChar(CP_ACP, 0, "SDL_App", -1, lpszW, nLen);
+
 	SDL_Window = CreateWindow(lpszW, lpszW, WS_VISIBLE,
                                   0, 0, 0, 0, NULL, NULL, SDL_Instance, NULL);
 	if ( SDL_Window == NULL ) {