changeset 77:1e7e61b9b0f9

Don't crash if freeing a cursor after quit...
author Sam Lantinga <slouken@lokigames.com>
date Tue, 19 Jun 2001 21:07:12 +0000
parents f28fa29a3a0c
children e9582f471c02
files src/video/SDL_cursor.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_cursor.c	Tue Jun 19 13:35:05 2001 +0000
+++ b/src/video/SDL_cursor.c	Tue Jun 19 21:07:12 2001 +0000
@@ -245,15 +245,16 @@
 			SDL_SetCursor(SDL_defcursor);
 		}
 		if ( cursor != SDL_defcursor ) {
+			SDL_VideoDevice *video = current_video;
+			SDL_VideoDevice *this  = current_video;
+
 			if ( cursor->data ) {
 				free(cursor->data);
 			}
 			if ( cursor->save[0] ) {
 				free(cursor->save[0]);
 			}
-			if ( cursor->wm_cursor ) {
-				SDL_VideoDevice *video = current_video;
-				SDL_VideoDevice *this  = current_video;
+			if ( video && cursor->wm_cursor ) {
 				video->FreeWMCursor(this, cursor->wm_cursor);
 			}
 			free(cursor);